{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.FraudDetector.Types.LabelSchema where
import qualified Amazonka.Core as Core
import Amazonka.FraudDetector.Types.UnlabeledEventsTreatment
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data LabelSchema = LabelSchema'
{
LabelSchema -> Maybe UnlabeledEventsTreatment
unlabeledEventsTreatment :: Prelude.Maybe UnlabeledEventsTreatment,
LabelSchema -> HashMap Text (NonEmpty Text)
labelMapper :: Prelude.HashMap Prelude.Text (Prelude.NonEmpty Prelude.Text)
}
deriving (LabelSchema -> LabelSchema -> Bool
(LabelSchema -> LabelSchema -> Bool)
-> (LabelSchema -> LabelSchema -> Bool) -> Eq LabelSchema
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LabelSchema -> LabelSchema -> Bool
$c/= :: LabelSchema -> LabelSchema -> Bool
== :: LabelSchema -> LabelSchema -> Bool
$c== :: LabelSchema -> LabelSchema -> Bool
Prelude.Eq, ReadPrec [LabelSchema]
ReadPrec LabelSchema
Int -> ReadS LabelSchema
ReadS [LabelSchema]
(Int -> ReadS LabelSchema)
-> ReadS [LabelSchema]
-> ReadPrec LabelSchema
-> ReadPrec [LabelSchema]
-> Read LabelSchema
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LabelSchema]
$creadListPrec :: ReadPrec [LabelSchema]
readPrec :: ReadPrec LabelSchema
$creadPrec :: ReadPrec LabelSchema
readList :: ReadS [LabelSchema]
$creadList :: ReadS [LabelSchema]
readsPrec :: Int -> ReadS LabelSchema
$creadsPrec :: Int -> ReadS LabelSchema
Prelude.Read, Int -> LabelSchema -> ShowS
[LabelSchema] -> ShowS
LabelSchema -> String
(Int -> LabelSchema -> ShowS)
-> (LabelSchema -> String)
-> ([LabelSchema] -> ShowS)
-> Show LabelSchema
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LabelSchema] -> ShowS
$cshowList :: [LabelSchema] -> ShowS
show :: LabelSchema -> String
$cshow :: LabelSchema -> String
showsPrec :: Int -> LabelSchema -> ShowS
$cshowsPrec :: Int -> LabelSchema -> ShowS
Prelude.Show, (forall x. LabelSchema -> Rep LabelSchema x)
-> (forall x. Rep LabelSchema x -> LabelSchema)
-> Generic LabelSchema
forall x. Rep LabelSchema x -> LabelSchema
forall x. LabelSchema -> Rep LabelSchema x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LabelSchema x -> LabelSchema
$cfrom :: forall x. LabelSchema -> Rep LabelSchema x
Prelude.Generic)
newLabelSchema ::
LabelSchema
newLabelSchema :: LabelSchema
newLabelSchema =
LabelSchema' :: Maybe UnlabeledEventsTreatment
-> HashMap Text (NonEmpty Text) -> LabelSchema
LabelSchema'
{ $sel:unlabeledEventsTreatment:LabelSchema' :: Maybe UnlabeledEventsTreatment
unlabeledEventsTreatment =
Maybe UnlabeledEventsTreatment
forall a. Maybe a
Prelude.Nothing,
$sel:labelMapper:LabelSchema' :: HashMap Text (NonEmpty Text)
labelMapper = HashMap Text (NonEmpty Text)
forall a. Monoid a => a
Prelude.mempty
}
labelSchema_unlabeledEventsTreatment :: Lens.Lens' LabelSchema (Prelude.Maybe UnlabeledEventsTreatment)
labelSchema_unlabeledEventsTreatment :: (Maybe UnlabeledEventsTreatment
-> f (Maybe UnlabeledEventsTreatment))
-> LabelSchema -> f LabelSchema
labelSchema_unlabeledEventsTreatment = (LabelSchema -> Maybe UnlabeledEventsTreatment)
-> (LabelSchema -> Maybe UnlabeledEventsTreatment -> LabelSchema)
-> Lens
LabelSchema
LabelSchema
(Maybe UnlabeledEventsTreatment)
(Maybe UnlabeledEventsTreatment)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LabelSchema' {Maybe UnlabeledEventsTreatment
unlabeledEventsTreatment :: Maybe UnlabeledEventsTreatment
$sel:unlabeledEventsTreatment:LabelSchema' :: LabelSchema -> Maybe UnlabeledEventsTreatment
unlabeledEventsTreatment} -> Maybe UnlabeledEventsTreatment
unlabeledEventsTreatment) (\s :: LabelSchema
s@LabelSchema' {} Maybe UnlabeledEventsTreatment
a -> LabelSchema
s {$sel:unlabeledEventsTreatment:LabelSchema' :: Maybe UnlabeledEventsTreatment
unlabeledEventsTreatment = Maybe UnlabeledEventsTreatment
a} :: LabelSchema)
labelSchema_labelMapper :: Lens.Lens' LabelSchema (Prelude.HashMap Prelude.Text (Prelude.NonEmpty Prelude.Text))
labelSchema_labelMapper :: (HashMap Text (NonEmpty Text) -> f (HashMap Text (NonEmpty Text)))
-> LabelSchema -> f LabelSchema
labelSchema_labelMapper = (LabelSchema -> HashMap Text (NonEmpty Text))
-> (LabelSchema -> HashMap Text (NonEmpty Text) -> LabelSchema)
-> Lens
LabelSchema
LabelSchema
(HashMap Text (NonEmpty Text))
(HashMap Text (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LabelSchema' {HashMap Text (NonEmpty Text)
labelMapper :: HashMap Text (NonEmpty Text)
$sel:labelMapper:LabelSchema' :: LabelSchema -> HashMap Text (NonEmpty Text)
labelMapper} -> HashMap Text (NonEmpty Text)
labelMapper) (\s :: LabelSchema
s@LabelSchema' {} HashMap Text (NonEmpty Text)
a -> LabelSchema
s {$sel:labelMapper:LabelSchema' :: HashMap Text (NonEmpty Text)
labelMapper = HashMap Text (NonEmpty Text)
a} :: LabelSchema) ((HashMap Text (NonEmpty Text) -> f (HashMap Text (NonEmpty Text)))
-> LabelSchema -> f LabelSchema)
-> ((HashMap Text (NonEmpty Text)
-> f (HashMap Text (NonEmpty Text)))
-> HashMap Text (NonEmpty Text)
-> f (HashMap Text (NonEmpty Text)))
-> (HashMap Text (NonEmpty Text)
-> f (HashMap Text (NonEmpty Text)))
-> LabelSchema
-> f LabelSchema
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (HashMap Text (NonEmpty Text) -> f (HashMap Text (NonEmpty Text)))
-> HashMap Text (NonEmpty Text) -> f (HashMap Text (NonEmpty Text))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON LabelSchema where
parseJSON :: Value -> Parser LabelSchema
parseJSON =
String
-> (Object -> Parser LabelSchema) -> Value -> Parser LabelSchema
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"LabelSchema"
( \Object
x ->
Maybe UnlabeledEventsTreatment
-> HashMap Text (NonEmpty Text) -> LabelSchema
LabelSchema'
(Maybe UnlabeledEventsTreatment
-> HashMap Text (NonEmpty Text) -> LabelSchema)
-> Parser (Maybe UnlabeledEventsTreatment)
-> Parser (HashMap Text (NonEmpty Text) -> LabelSchema)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe UnlabeledEventsTreatment)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"unlabeledEventsTreatment")
Parser (HashMap Text (NonEmpty Text) -> LabelSchema)
-> Parser (HashMap Text (NonEmpty Text)) -> Parser LabelSchema
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (HashMap Text (NonEmpty Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"labelMapper" Parser (Maybe (HashMap Text (NonEmpty Text)))
-> HashMap Text (NonEmpty Text)
-> Parser (HashMap Text (NonEmpty Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= HashMap Text (NonEmpty Text)
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable LabelSchema
instance Prelude.NFData LabelSchema
instance Core.ToJSON LabelSchema where
toJSON :: LabelSchema -> Value
toJSON LabelSchema' {Maybe UnlabeledEventsTreatment
HashMap Text (NonEmpty Text)
labelMapper :: HashMap Text (NonEmpty Text)
unlabeledEventsTreatment :: Maybe UnlabeledEventsTreatment
$sel:labelMapper:LabelSchema' :: LabelSchema -> HashMap Text (NonEmpty Text)
$sel:unlabeledEventsTreatment:LabelSchema' :: LabelSchema -> Maybe UnlabeledEventsTreatment
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"unlabeledEventsTreatment" Text -> UnlabeledEventsTreatment -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(UnlabeledEventsTreatment -> Pair)
-> Maybe UnlabeledEventsTreatment -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe UnlabeledEventsTreatment
unlabeledEventsTreatment,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"labelMapper" Text -> HashMap Text (NonEmpty Text) -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= HashMap Text (NonEmpty Text)
labelMapper)
]
)