{-# 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.MechanicalTurk.Types.QualificationRequirement where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MechanicalTurk.Types.Comparator
import Amazonka.MechanicalTurk.Types.HITAccessActions
import Amazonka.MechanicalTurk.Types.Locale
import qualified Amazonka.Prelude as Prelude
data QualificationRequirement = QualificationRequirement'
{
QualificationRequirement -> Maybe [Locale]
localeValues :: Prelude.Maybe [Locale],
QualificationRequirement -> Maybe HITAccessActions
actionsGuarded :: Prelude.Maybe HITAccessActions,
QualificationRequirement -> Maybe Bool
requiredToPreview :: Prelude.Maybe Prelude.Bool,
QualificationRequirement -> Maybe [Int]
integerValues :: Prelude.Maybe [Prelude.Int],
QualificationRequirement -> Text
qualificationTypeId :: Prelude.Text,
QualificationRequirement -> Comparator
comparator :: Comparator
}
deriving (QualificationRequirement -> QualificationRequirement -> Bool
(QualificationRequirement -> QualificationRequirement -> Bool)
-> (QualificationRequirement -> QualificationRequirement -> Bool)
-> Eq QualificationRequirement
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: QualificationRequirement -> QualificationRequirement -> Bool
$c/= :: QualificationRequirement -> QualificationRequirement -> Bool
== :: QualificationRequirement -> QualificationRequirement -> Bool
$c== :: QualificationRequirement -> QualificationRequirement -> Bool
Prelude.Eq, ReadPrec [QualificationRequirement]
ReadPrec QualificationRequirement
Int -> ReadS QualificationRequirement
ReadS [QualificationRequirement]
(Int -> ReadS QualificationRequirement)
-> ReadS [QualificationRequirement]
-> ReadPrec QualificationRequirement
-> ReadPrec [QualificationRequirement]
-> Read QualificationRequirement
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [QualificationRequirement]
$creadListPrec :: ReadPrec [QualificationRequirement]
readPrec :: ReadPrec QualificationRequirement
$creadPrec :: ReadPrec QualificationRequirement
readList :: ReadS [QualificationRequirement]
$creadList :: ReadS [QualificationRequirement]
readsPrec :: Int -> ReadS QualificationRequirement
$creadsPrec :: Int -> ReadS QualificationRequirement
Prelude.Read, Int -> QualificationRequirement -> ShowS
[QualificationRequirement] -> ShowS
QualificationRequirement -> String
(Int -> QualificationRequirement -> ShowS)
-> (QualificationRequirement -> String)
-> ([QualificationRequirement] -> ShowS)
-> Show QualificationRequirement
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [QualificationRequirement] -> ShowS
$cshowList :: [QualificationRequirement] -> ShowS
show :: QualificationRequirement -> String
$cshow :: QualificationRequirement -> String
showsPrec :: Int -> QualificationRequirement -> ShowS
$cshowsPrec :: Int -> QualificationRequirement -> ShowS
Prelude.Show, (forall x.
QualificationRequirement -> Rep QualificationRequirement x)
-> (forall x.
Rep QualificationRequirement x -> QualificationRequirement)
-> Generic QualificationRequirement
forall x.
Rep QualificationRequirement x -> QualificationRequirement
forall x.
QualificationRequirement -> Rep QualificationRequirement x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep QualificationRequirement x -> QualificationRequirement
$cfrom :: forall x.
QualificationRequirement -> Rep QualificationRequirement x
Prelude.Generic)
newQualificationRequirement ::
Prelude.Text ->
Comparator ->
QualificationRequirement
newQualificationRequirement :: Text -> Comparator -> QualificationRequirement
newQualificationRequirement
Text
pQualificationTypeId_
Comparator
pComparator_ =
QualificationRequirement' :: Maybe [Locale]
-> Maybe HITAccessActions
-> Maybe Bool
-> Maybe [Int]
-> Text
-> Comparator
-> QualificationRequirement
QualificationRequirement'
{ $sel:localeValues:QualificationRequirement' :: Maybe [Locale]
localeValues =
Maybe [Locale]
forall a. Maybe a
Prelude.Nothing,
$sel:actionsGuarded:QualificationRequirement' :: Maybe HITAccessActions
actionsGuarded = Maybe HITAccessActions
forall a. Maybe a
Prelude.Nothing,
$sel:requiredToPreview:QualificationRequirement' :: Maybe Bool
requiredToPreview = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:integerValues:QualificationRequirement' :: Maybe [Int]
integerValues = Maybe [Int]
forall a. Maybe a
Prelude.Nothing,
$sel:qualificationTypeId:QualificationRequirement' :: Text
qualificationTypeId = Text
pQualificationTypeId_,
$sel:comparator:QualificationRequirement' :: Comparator
comparator = Comparator
pComparator_
}
qualificationRequirement_localeValues :: Lens.Lens' QualificationRequirement (Prelude.Maybe [Locale])
qualificationRequirement_localeValues :: (Maybe [Locale] -> f (Maybe [Locale]))
-> QualificationRequirement -> f QualificationRequirement
qualificationRequirement_localeValues = (QualificationRequirement -> Maybe [Locale])
-> (QualificationRequirement
-> Maybe [Locale] -> QualificationRequirement)
-> Lens
QualificationRequirement
QualificationRequirement
(Maybe [Locale])
(Maybe [Locale])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QualificationRequirement' {Maybe [Locale]
localeValues :: Maybe [Locale]
$sel:localeValues:QualificationRequirement' :: QualificationRequirement -> Maybe [Locale]
localeValues} -> Maybe [Locale]
localeValues) (\s :: QualificationRequirement
s@QualificationRequirement' {} Maybe [Locale]
a -> QualificationRequirement
s {$sel:localeValues:QualificationRequirement' :: Maybe [Locale]
localeValues = Maybe [Locale]
a} :: QualificationRequirement) ((Maybe [Locale] -> f (Maybe [Locale]))
-> QualificationRequirement -> f QualificationRequirement)
-> ((Maybe [Locale] -> f (Maybe [Locale]))
-> Maybe [Locale] -> f (Maybe [Locale]))
-> (Maybe [Locale] -> f (Maybe [Locale]))
-> QualificationRequirement
-> f QualificationRequirement
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Locale] [Locale] [Locale] [Locale]
-> Iso
(Maybe [Locale]) (Maybe [Locale]) (Maybe [Locale]) (Maybe [Locale])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Locale] [Locale] [Locale] [Locale]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
qualificationRequirement_actionsGuarded :: Lens.Lens' QualificationRequirement (Prelude.Maybe HITAccessActions)
qualificationRequirement_actionsGuarded :: (Maybe HITAccessActions -> f (Maybe HITAccessActions))
-> QualificationRequirement -> f QualificationRequirement
qualificationRequirement_actionsGuarded = (QualificationRequirement -> Maybe HITAccessActions)
-> (QualificationRequirement
-> Maybe HITAccessActions -> QualificationRequirement)
-> Lens
QualificationRequirement
QualificationRequirement
(Maybe HITAccessActions)
(Maybe HITAccessActions)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QualificationRequirement' {Maybe HITAccessActions
actionsGuarded :: Maybe HITAccessActions
$sel:actionsGuarded:QualificationRequirement' :: QualificationRequirement -> Maybe HITAccessActions
actionsGuarded} -> Maybe HITAccessActions
actionsGuarded) (\s :: QualificationRequirement
s@QualificationRequirement' {} Maybe HITAccessActions
a -> QualificationRequirement
s {$sel:actionsGuarded:QualificationRequirement' :: Maybe HITAccessActions
actionsGuarded = Maybe HITAccessActions
a} :: QualificationRequirement)
qualificationRequirement_requiredToPreview :: Lens.Lens' QualificationRequirement (Prelude.Maybe Prelude.Bool)
qualificationRequirement_requiredToPreview :: (Maybe Bool -> f (Maybe Bool))
-> QualificationRequirement -> f QualificationRequirement
qualificationRequirement_requiredToPreview = (QualificationRequirement -> Maybe Bool)
-> (QualificationRequirement
-> Maybe Bool -> QualificationRequirement)
-> Lens
QualificationRequirement
QualificationRequirement
(Maybe Bool)
(Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QualificationRequirement' {Maybe Bool
requiredToPreview :: Maybe Bool
$sel:requiredToPreview:QualificationRequirement' :: QualificationRequirement -> Maybe Bool
requiredToPreview} -> Maybe Bool
requiredToPreview) (\s :: QualificationRequirement
s@QualificationRequirement' {} Maybe Bool
a -> QualificationRequirement
s {$sel:requiredToPreview:QualificationRequirement' :: Maybe Bool
requiredToPreview = Maybe Bool
a} :: QualificationRequirement)
qualificationRequirement_integerValues :: Lens.Lens' QualificationRequirement (Prelude.Maybe [Prelude.Int])
qualificationRequirement_integerValues :: (Maybe [Int] -> f (Maybe [Int]))
-> QualificationRequirement -> f QualificationRequirement
qualificationRequirement_integerValues = (QualificationRequirement -> Maybe [Int])
-> (QualificationRequirement
-> Maybe [Int] -> QualificationRequirement)
-> Lens
QualificationRequirement
QualificationRequirement
(Maybe [Int])
(Maybe [Int])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QualificationRequirement' {Maybe [Int]
integerValues :: Maybe [Int]
$sel:integerValues:QualificationRequirement' :: QualificationRequirement -> Maybe [Int]
integerValues} -> Maybe [Int]
integerValues) (\s :: QualificationRequirement
s@QualificationRequirement' {} Maybe [Int]
a -> QualificationRequirement
s {$sel:integerValues:QualificationRequirement' :: Maybe [Int]
integerValues = Maybe [Int]
a} :: QualificationRequirement) ((Maybe [Int] -> f (Maybe [Int]))
-> QualificationRequirement -> f QualificationRequirement)
-> ((Maybe [Int] -> f (Maybe [Int]))
-> Maybe [Int] -> f (Maybe [Int]))
-> (Maybe [Int] -> f (Maybe [Int]))
-> QualificationRequirement
-> f QualificationRequirement
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Int] [Int] [Int] [Int]
-> Iso (Maybe [Int]) (Maybe [Int]) (Maybe [Int]) (Maybe [Int])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Int] [Int] [Int] [Int]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
qualificationRequirement_qualificationTypeId :: Lens.Lens' QualificationRequirement Prelude.Text
qualificationRequirement_qualificationTypeId :: (Text -> f Text)
-> QualificationRequirement -> f QualificationRequirement
qualificationRequirement_qualificationTypeId = (QualificationRequirement -> Text)
-> (QualificationRequirement -> Text -> QualificationRequirement)
-> Lens QualificationRequirement QualificationRequirement Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QualificationRequirement' {Text
qualificationTypeId :: Text
$sel:qualificationTypeId:QualificationRequirement' :: QualificationRequirement -> Text
qualificationTypeId} -> Text
qualificationTypeId) (\s :: QualificationRequirement
s@QualificationRequirement' {} Text
a -> QualificationRequirement
s {$sel:qualificationTypeId:QualificationRequirement' :: Text
qualificationTypeId = Text
a} :: QualificationRequirement)
qualificationRequirement_comparator :: Lens.Lens' QualificationRequirement Comparator
qualificationRequirement_comparator :: (Comparator -> f Comparator)
-> QualificationRequirement -> f QualificationRequirement
qualificationRequirement_comparator = (QualificationRequirement -> Comparator)
-> (QualificationRequirement
-> Comparator -> QualificationRequirement)
-> Lens
QualificationRequirement
QualificationRequirement
Comparator
Comparator
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QualificationRequirement' {Comparator
comparator :: Comparator
$sel:comparator:QualificationRequirement' :: QualificationRequirement -> Comparator
comparator} -> Comparator
comparator) (\s :: QualificationRequirement
s@QualificationRequirement' {} Comparator
a -> QualificationRequirement
s {$sel:comparator:QualificationRequirement' :: Comparator
comparator = Comparator
a} :: QualificationRequirement)
instance Core.FromJSON QualificationRequirement where
parseJSON :: Value -> Parser QualificationRequirement
parseJSON =
String
-> (Object -> Parser QualificationRequirement)
-> Value
-> Parser QualificationRequirement
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"QualificationRequirement"
( \Object
x ->
Maybe [Locale]
-> Maybe HITAccessActions
-> Maybe Bool
-> Maybe [Int]
-> Text
-> Comparator
-> QualificationRequirement
QualificationRequirement'
(Maybe [Locale]
-> Maybe HITAccessActions
-> Maybe Bool
-> Maybe [Int]
-> Text
-> Comparator
-> QualificationRequirement)
-> Parser (Maybe [Locale])
-> Parser
(Maybe HITAccessActions
-> Maybe Bool
-> Maybe [Int]
-> Text
-> Comparator
-> QualificationRequirement)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [Locale]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LocaleValues" Parser (Maybe (Maybe [Locale]))
-> Maybe [Locale] -> Parser (Maybe [Locale])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Locale]
forall a. Monoid a => a
Prelude.mempty)
Parser
(Maybe HITAccessActions
-> Maybe Bool
-> Maybe [Int]
-> Text
-> Comparator
-> QualificationRequirement)
-> Parser (Maybe HITAccessActions)
-> Parser
(Maybe Bool
-> Maybe [Int] -> Text -> Comparator -> QualificationRequirement)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe HITAccessActions)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ActionsGuarded")
Parser
(Maybe Bool
-> Maybe [Int] -> Text -> Comparator -> QualificationRequirement)
-> Parser (Maybe Bool)
-> Parser
(Maybe [Int] -> Text -> Comparator -> QualificationRequirement)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RequiredToPreview")
Parser
(Maybe [Int] -> Text -> Comparator -> QualificationRequirement)
-> Parser (Maybe [Int])
-> Parser (Text -> Comparator -> QualificationRequirement)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Int]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"IntegerValues" Parser (Maybe (Maybe [Int])) -> Maybe [Int] -> Parser (Maybe [Int])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Int]
forall a. Monoid a => a
Prelude.mempty)
Parser (Text -> Comparator -> QualificationRequirement)
-> Parser Text -> Parser (Comparator -> QualificationRequirement)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"QualificationTypeId")
Parser (Comparator -> QualificationRequirement)
-> Parser Comparator -> Parser QualificationRequirement
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Comparator
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Comparator")
)
instance Prelude.Hashable QualificationRequirement
instance Prelude.NFData QualificationRequirement
instance Core.ToJSON QualificationRequirement where
toJSON :: QualificationRequirement -> Value
toJSON QualificationRequirement' {Maybe Bool
Maybe [Int]
Maybe [Locale]
Maybe HITAccessActions
Text
Comparator
comparator :: Comparator
qualificationTypeId :: Text
integerValues :: Maybe [Int]
requiredToPreview :: Maybe Bool
actionsGuarded :: Maybe HITAccessActions
localeValues :: Maybe [Locale]
$sel:comparator:QualificationRequirement' :: QualificationRequirement -> Comparator
$sel:qualificationTypeId:QualificationRequirement' :: QualificationRequirement -> Text
$sel:integerValues:QualificationRequirement' :: QualificationRequirement -> Maybe [Int]
$sel:requiredToPreview:QualificationRequirement' :: QualificationRequirement -> Maybe Bool
$sel:actionsGuarded:QualificationRequirement' :: QualificationRequirement -> Maybe HITAccessActions
$sel:localeValues:QualificationRequirement' :: QualificationRequirement -> Maybe [Locale]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"LocaleValues" Text -> [Locale] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Locale] -> Pair) -> Maybe [Locale] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Locale]
localeValues,
(Text
"ActionsGuarded" Text -> HITAccessActions -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(HITAccessActions -> Pair) -> Maybe HITAccessActions -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe HITAccessActions
actionsGuarded,
(Text
"RequiredToPreview" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
requiredToPreview,
(Text
"IntegerValues" Text -> [Int] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Int] -> Pair) -> Maybe [Int] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Int]
integerValues,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"QualificationTypeId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
qualificationTypeId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Comparator" Text -> Comparator -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Comparator
comparator)
]
)