{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.MechanicalTurk.Types.QualificationRequirement
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
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

-- | The QualificationRequirement data structure describes a Qualification
-- that a Worker must have before the Worker is allowed to accept a HIT. A
-- requirement may optionally state that a Worker must have the
-- Qualification in order to preview the HIT, or see the HIT in search
-- results.
--
-- /See:/ 'newQualificationRequirement' smart constructor.
data QualificationRequirement = QualificationRequirement'
  { -- | The locale value to compare against the Qualification\'s value. The
    -- local value must be a valid ISO 3166 country code or supports ISO 3166-2
    -- subdivisions. LocaleValue can only be used with a Worker_Locale
    -- QualificationType ID. LocaleValue can only be used with the EqualTo,
    -- NotEqualTo, In, and NotIn comparators. You must only use a single
    -- LocaleValue element when using the EqualTo or NotEqualTo comparators.
    -- When performing a set comparison by using the In or the NotIn
    -- comparator, you can use up to 30 LocaleValue elements in a
    -- QualificationRequirement data structure.
    QualificationRequirement -> Maybe [Locale]
localeValues :: Prelude.Maybe [Locale],
    -- | Setting this attribute prevents Workers whose Qualifications do not meet
    -- this QualificationRequirement from taking the specified action. Valid
    -- arguments include \"Accept\" (Worker cannot accept the HIT, but can
    -- preview the HIT and see it in their search results),
    -- \"PreviewAndAccept\" (Worker cannot accept or preview the HIT, but can
    -- see the HIT in their search results), and \"DiscoverPreviewAndAccept\"
    -- (Worker cannot accept, preview, or see the HIT in their search results).
    -- It\'s possible for you to create a HIT with multiple
    -- QualificationRequirements (which can have different values for the
    -- ActionGuarded attribute). In this case, the Worker is only permitted to
    -- perform an action when they have met all QualificationRequirements
    -- guarding the action. The actions in the order of least restrictive to
    -- most restrictive are Discover, Preview and Accept. For example, if a
    -- Worker meets all QualificationRequirements that are set to
    -- DiscoverPreviewAndAccept, but do not meet all requirements that are set
    -- with PreviewAndAccept, then the Worker will be able to Discover, i.e.
    -- see the HIT in their search result, but will not be able to Preview or
    -- Accept the HIT. ActionsGuarded should not be used in combination with
    -- the @RequiredToPreview@ field.
    QualificationRequirement -> Maybe HITAccessActions
actionsGuarded :: Prelude.Maybe HITAccessActions,
    -- | DEPRECATED: Use the @ActionsGuarded@ field instead. If RequiredToPreview
    -- is true, the question data for the HIT will not be shown when a Worker
    -- whose Qualifications do not meet this requirement tries to preview the
    -- HIT. That is, a Worker\'s Qualifications must meet all of the
    -- requirements for which RequiredToPreview is true in order to preview the
    -- HIT. If a Worker meets all of the requirements where RequiredToPreview
    -- is true (or if there are no such requirements), but does not meet all of
    -- the requirements for the HIT, the Worker will be allowed to preview the
    -- HIT\'s question data, but will not be allowed to accept and complete the
    -- HIT. The default is false. This should not be used in combination with
    -- the @ActionsGuarded@ field.
    QualificationRequirement -> Maybe Bool
requiredToPreview :: Prelude.Maybe Prelude.Bool,
    -- | The integer value to compare against the Qualification\'s value.
    -- IntegerValue must not be present if Comparator is Exists or
    -- DoesNotExist. IntegerValue can only be used if the Qualification type
    -- has an integer value; it cannot be used with the Worker_Locale
    -- QualificationType ID. When performing a set comparison by using the In
    -- or the NotIn comparator, you can use up to 15 IntegerValue elements in a
    -- QualificationRequirement data structure.
    QualificationRequirement -> Maybe [Int]
integerValues :: Prelude.Maybe [Prelude.Int],
    -- | The ID of the Qualification type for the requirement.
    QualificationRequirement -> Text
qualificationTypeId :: Prelude.Text,
    -- | The kind of comparison to make against a Qualification\'s value. You can
    -- compare a Qualification\'s value to an IntegerValue to see if it is
    -- LessThan, LessThanOrEqualTo, GreaterThan, GreaterThanOrEqualTo, EqualTo,
    -- or NotEqualTo the IntegerValue. You can compare it to a LocaleValue to
    -- see if it is EqualTo, or NotEqualTo the LocaleValue. You can check to
    -- see if the value is In or NotIn a set of IntegerValue or LocaleValue
    -- values. Lastly, a Qualification requirement can also test if a
    -- Qualification Exists or DoesNotExist in the user\'s profile, regardless
    -- of its value.
    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)

-- |
-- Create a value of 'QualificationRequirement' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'localeValues', 'qualificationRequirement_localeValues' - The locale value to compare against the Qualification\'s value. The
-- local value must be a valid ISO 3166 country code or supports ISO 3166-2
-- subdivisions. LocaleValue can only be used with a Worker_Locale
-- QualificationType ID. LocaleValue can only be used with the EqualTo,
-- NotEqualTo, In, and NotIn comparators. You must only use a single
-- LocaleValue element when using the EqualTo or NotEqualTo comparators.
-- When performing a set comparison by using the In or the NotIn
-- comparator, you can use up to 30 LocaleValue elements in a
-- QualificationRequirement data structure.
--
-- 'actionsGuarded', 'qualificationRequirement_actionsGuarded' - Setting this attribute prevents Workers whose Qualifications do not meet
-- this QualificationRequirement from taking the specified action. Valid
-- arguments include \"Accept\" (Worker cannot accept the HIT, but can
-- preview the HIT and see it in their search results),
-- \"PreviewAndAccept\" (Worker cannot accept or preview the HIT, but can
-- see the HIT in their search results), and \"DiscoverPreviewAndAccept\"
-- (Worker cannot accept, preview, or see the HIT in their search results).
-- It\'s possible for you to create a HIT with multiple
-- QualificationRequirements (which can have different values for the
-- ActionGuarded attribute). In this case, the Worker is only permitted to
-- perform an action when they have met all QualificationRequirements
-- guarding the action. The actions in the order of least restrictive to
-- most restrictive are Discover, Preview and Accept. For example, if a
-- Worker meets all QualificationRequirements that are set to
-- DiscoverPreviewAndAccept, but do not meet all requirements that are set
-- with PreviewAndAccept, then the Worker will be able to Discover, i.e.
-- see the HIT in their search result, but will not be able to Preview or
-- Accept the HIT. ActionsGuarded should not be used in combination with
-- the @RequiredToPreview@ field.
--
-- 'requiredToPreview', 'qualificationRequirement_requiredToPreview' - DEPRECATED: Use the @ActionsGuarded@ field instead. If RequiredToPreview
-- is true, the question data for the HIT will not be shown when a Worker
-- whose Qualifications do not meet this requirement tries to preview the
-- HIT. That is, a Worker\'s Qualifications must meet all of the
-- requirements for which RequiredToPreview is true in order to preview the
-- HIT. If a Worker meets all of the requirements where RequiredToPreview
-- is true (or if there are no such requirements), but does not meet all of
-- the requirements for the HIT, the Worker will be allowed to preview the
-- HIT\'s question data, but will not be allowed to accept and complete the
-- HIT. The default is false. This should not be used in combination with
-- the @ActionsGuarded@ field.
--
-- 'integerValues', 'qualificationRequirement_integerValues' - The integer value to compare against the Qualification\'s value.
-- IntegerValue must not be present if Comparator is Exists or
-- DoesNotExist. IntegerValue can only be used if the Qualification type
-- has an integer value; it cannot be used with the Worker_Locale
-- QualificationType ID. When performing a set comparison by using the In
-- or the NotIn comparator, you can use up to 15 IntegerValue elements in a
-- QualificationRequirement data structure.
--
-- 'qualificationTypeId', 'qualificationRequirement_qualificationTypeId' - The ID of the Qualification type for the requirement.
--
-- 'comparator', 'qualificationRequirement_comparator' - The kind of comparison to make against a Qualification\'s value. You can
-- compare a Qualification\'s value to an IntegerValue to see if it is
-- LessThan, LessThanOrEqualTo, GreaterThan, GreaterThanOrEqualTo, EqualTo,
-- or NotEqualTo the IntegerValue. You can compare it to a LocaleValue to
-- see if it is EqualTo, or NotEqualTo the LocaleValue. You can check to
-- see if the value is In or NotIn a set of IntegerValue or LocaleValue
-- values. Lastly, a Qualification requirement can also test if a
-- Qualification Exists or DoesNotExist in the user\'s profile, regardless
-- of its value.
newQualificationRequirement ::
  -- | 'qualificationTypeId'
  Prelude.Text ->
  -- | 'comparator'
  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_
      }

-- | The locale value to compare against the Qualification\'s value. The
-- local value must be a valid ISO 3166 country code or supports ISO 3166-2
-- subdivisions. LocaleValue can only be used with a Worker_Locale
-- QualificationType ID. LocaleValue can only be used with the EqualTo,
-- NotEqualTo, In, and NotIn comparators. You must only use a single
-- LocaleValue element when using the EqualTo or NotEqualTo comparators.
-- When performing a set comparison by using the In or the NotIn
-- comparator, you can use up to 30 LocaleValue elements in a
-- QualificationRequirement data structure.
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

-- | Setting this attribute prevents Workers whose Qualifications do not meet
-- this QualificationRequirement from taking the specified action. Valid
-- arguments include \"Accept\" (Worker cannot accept the HIT, but can
-- preview the HIT and see it in their search results),
-- \"PreviewAndAccept\" (Worker cannot accept or preview the HIT, but can
-- see the HIT in their search results), and \"DiscoverPreviewAndAccept\"
-- (Worker cannot accept, preview, or see the HIT in their search results).
-- It\'s possible for you to create a HIT with multiple
-- QualificationRequirements (which can have different values for the
-- ActionGuarded attribute). In this case, the Worker is only permitted to
-- perform an action when they have met all QualificationRequirements
-- guarding the action. The actions in the order of least restrictive to
-- most restrictive are Discover, Preview and Accept. For example, if a
-- Worker meets all QualificationRequirements that are set to
-- DiscoverPreviewAndAccept, but do not meet all requirements that are set
-- with PreviewAndAccept, then the Worker will be able to Discover, i.e.
-- see the HIT in their search result, but will not be able to Preview or
-- Accept the HIT. ActionsGuarded should not be used in combination with
-- the @RequiredToPreview@ field.
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)

-- | DEPRECATED: Use the @ActionsGuarded@ field instead. If RequiredToPreview
-- is true, the question data for the HIT will not be shown when a Worker
-- whose Qualifications do not meet this requirement tries to preview the
-- HIT. That is, a Worker\'s Qualifications must meet all of the
-- requirements for which RequiredToPreview is true in order to preview the
-- HIT. If a Worker meets all of the requirements where RequiredToPreview
-- is true (or if there are no such requirements), but does not meet all of
-- the requirements for the HIT, the Worker will be allowed to preview the
-- HIT\'s question data, but will not be allowed to accept and complete the
-- HIT. The default is false. This should not be used in combination with
-- the @ActionsGuarded@ field.
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)

-- | The integer value to compare against the Qualification\'s value.
-- IntegerValue must not be present if Comparator is Exists or
-- DoesNotExist. IntegerValue can only be used if the Qualification type
-- has an integer value; it cannot be used with the Worker_Locale
-- QualificationType ID. When performing a set comparison by using the In
-- or the NotIn comparator, you can use up to 15 IntegerValue elements in a
-- QualificationRequirement data structure.
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

-- | The ID of the Qualification type for the requirement.
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)

-- | The kind of comparison to make against a Qualification\'s value. You can
-- compare a Qualification\'s value to an IntegerValue to see if it is
-- LessThan, LessThanOrEqualTo, GreaterThan, GreaterThanOrEqualTo, EqualTo,
-- or NotEqualTo the IntegerValue. You can compare it to a LocaleValue to
-- see if it is EqualTo, or NotEqualTo the LocaleValue. You can check to
-- see if the value is In or NotIn a set of IntegerValue or LocaleValue
-- values. Lastly, a Qualification requirement can also test if a
-- Qualification Exists or DoesNotExist in the user\'s profile, regardless
-- of its value.
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)
          ]
      )