{-# 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.QualificationRequest
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.MechanicalTurk.Types.QualificationRequest where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | The QualificationRequest data structure represents a request a Worker
-- has made for a Qualification.
--
-- /See:/ 'newQualificationRequest' smart constructor.
data QualificationRequest = QualificationRequest'
  { -- | The Worker\'s answers for the Qualification type\'s test contained in a
    -- QuestionFormAnswers document, if the type has a test and the Worker has
    -- submitted answers. If the Worker does not provide any answers, Answer
    -- may be empty.
    QualificationRequest -> Maybe Text
answer :: Prelude.Maybe Prelude.Text,
    -- | The ID of the Qualification request, a unique identifier generated when
    -- the request was submitted.
    QualificationRequest -> Maybe Text
qualificationRequestId :: Prelude.Maybe Prelude.Text,
    -- | The ID of the Qualification type the Worker is requesting, as returned
    -- by the CreateQualificationType operation.
    QualificationRequest -> Maybe Text
qualificationTypeId :: Prelude.Maybe Prelude.Text,
    -- | The date and time the Qualification request had a status of Submitted.
    -- This is either the time the Worker submitted answers for a Qualification
    -- test, or the time the Worker requested the Qualification if the
    -- Qualification type does not have a test.
    QualificationRequest -> Maybe POSIX
submitTime :: Prelude.Maybe Data.POSIX,
    -- | The contents of the Qualification test that was presented to the Worker,
    -- if the type has a test and the Worker has submitted answers. This value
    -- is identical to the QuestionForm associated with the Qualification type
    -- at the time the Worker requests the Qualification.
    QualificationRequest -> Maybe Text
test :: Prelude.Maybe Prelude.Text,
    -- | The ID of the Worker requesting the Qualification.
    QualificationRequest -> Maybe Text
workerId :: Prelude.Maybe Prelude.Text
  }
  deriving (QualificationRequest -> QualificationRequest -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: QualificationRequest -> QualificationRequest -> Bool
$c/= :: QualificationRequest -> QualificationRequest -> Bool
== :: QualificationRequest -> QualificationRequest -> Bool
$c== :: QualificationRequest -> QualificationRequest -> Bool
Prelude.Eq, ReadPrec [QualificationRequest]
ReadPrec QualificationRequest
Int -> ReadS QualificationRequest
ReadS [QualificationRequest]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [QualificationRequest]
$creadListPrec :: ReadPrec [QualificationRequest]
readPrec :: ReadPrec QualificationRequest
$creadPrec :: ReadPrec QualificationRequest
readList :: ReadS [QualificationRequest]
$creadList :: ReadS [QualificationRequest]
readsPrec :: Int -> ReadS QualificationRequest
$creadsPrec :: Int -> ReadS QualificationRequest
Prelude.Read, Int -> QualificationRequest -> ShowS
[QualificationRequest] -> ShowS
QualificationRequest -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [QualificationRequest] -> ShowS
$cshowList :: [QualificationRequest] -> ShowS
show :: QualificationRequest -> String
$cshow :: QualificationRequest -> String
showsPrec :: Int -> QualificationRequest -> ShowS
$cshowsPrec :: Int -> QualificationRequest -> ShowS
Prelude.Show, forall x. Rep QualificationRequest x -> QualificationRequest
forall x. QualificationRequest -> Rep QualificationRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep QualificationRequest x -> QualificationRequest
$cfrom :: forall x. QualificationRequest -> Rep QualificationRequest x
Prelude.Generic)

-- |
-- Create a value of 'QualificationRequest' 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:
--
-- 'answer', 'qualificationRequest_answer' - The Worker\'s answers for the Qualification type\'s test contained in a
-- QuestionFormAnswers document, if the type has a test and the Worker has
-- submitted answers. If the Worker does not provide any answers, Answer
-- may be empty.
--
-- 'qualificationRequestId', 'qualificationRequest_qualificationRequestId' - The ID of the Qualification request, a unique identifier generated when
-- the request was submitted.
--
-- 'qualificationTypeId', 'qualificationRequest_qualificationTypeId' - The ID of the Qualification type the Worker is requesting, as returned
-- by the CreateQualificationType operation.
--
-- 'submitTime', 'qualificationRequest_submitTime' - The date and time the Qualification request had a status of Submitted.
-- This is either the time the Worker submitted answers for a Qualification
-- test, or the time the Worker requested the Qualification if the
-- Qualification type does not have a test.
--
-- 'test', 'qualificationRequest_test' - The contents of the Qualification test that was presented to the Worker,
-- if the type has a test and the Worker has submitted answers. This value
-- is identical to the QuestionForm associated with the Qualification type
-- at the time the Worker requests the Qualification.
--
-- 'workerId', 'qualificationRequest_workerId' - The ID of the Worker requesting the Qualification.
newQualificationRequest ::
  QualificationRequest
newQualificationRequest :: QualificationRequest
newQualificationRequest =
  QualificationRequest'
    { $sel:answer:QualificationRequest' :: Maybe Text
answer = forall a. Maybe a
Prelude.Nothing,
      $sel:qualificationRequestId:QualificationRequest' :: Maybe Text
qualificationRequestId = forall a. Maybe a
Prelude.Nothing,
      $sel:qualificationTypeId:QualificationRequest' :: Maybe Text
qualificationTypeId = forall a. Maybe a
Prelude.Nothing,
      $sel:submitTime:QualificationRequest' :: Maybe POSIX
submitTime = forall a. Maybe a
Prelude.Nothing,
      $sel:test:QualificationRequest' :: Maybe Text
test = forall a. Maybe a
Prelude.Nothing,
      $sel:workerId:QualificationRequest' :: Maybe Text
workerId = forall a. Maybe a
Prelude.Nothing
    }

-- | The Worker\'s answers for the Qualification type\'s test contained in a
-- QuestionFormAnswers document, if the type has a test and the Worker has
-- submitted answers. If the Worker does not provide any answers, Answer
-- may be empty.
qualificationRequest_answer :: Lens.Lens' QualificationRequest (Prelude.Maybe Prelude.Text)
qualificationRequest_answer :: Lens' QualificationRequest (Maybe Text)
qualificationRequest_answer = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QualificationRequest' {Maybe Text
answer :: Maybe Text
$sel:answer:QualificationRequest' :: QualificationRequest -> Maybe Text
answer} -> Maybe Text
answer) (\s :: QualificationRequest
s@QualificationRequest' {} Maybe Text
a -> QualificationRequest
s {$sel:answer:QualificationRequest' :: Maybe Text
answer = Maybe Text
a} :: QualificationRequest)

-- | The ID of the Qualification request, a unique identifier generated when
-- the request was submitted.
qualificationRequest_qualificationRequestId :: Lens.Lens' QualificationRequest (Prelude.Maybe Prelude.Text)
qualificationRequest_qualificationRequestId :: Lens' QualificationRequest (Maybe Text)
qualificationRequest_qualificationRequestId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QualificationRequest' {Maybe Text
qualificationRequestId :: Maybe Text
$sel:qualificationRequestId:QualificationRequest' :: QualificationRequest -> Maybe Text
qualificationRequestId} -> Maybe Text
qualificationRequestId) (\s :: QualificationRequest
s@QualificationRequest' {} Maybe Text
a -> QualificationRequest
s {$sel:qualificationRequestId:QualificationRequest' :: Maybe Text
qualificationRequestId = Maybe Text
a} :: QualificationRequest)

-- | The ID of the Qualification type the Worker is requesting, as returned
-- by the CreateQualificationType operation.
qualificationRequest_qualificationTypeId :: Lens.Lens' QualificationRequest (Prelude.Maybe Prelude.Text)
qualificationRequest_qualificationTypeId :: Lens' QualificationRequest (Maybe Text)
qualificationRequest_qualificationTypeId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QualificationRequest' {Maybe Text
qualificationTypeId :: Maybe Text
$sel:qualificationTypeId:QualificationRequest' :: QualificationRequest -> Maybe Text
qualificationTypeId} -> Maybe Text
qualificationTypeId) (\s :: QualificationRequest
s@QualificationRequest' {} Maybe Text
a -> QualificationRequest
s {$sel:qualificationTypeId:QualificationRequest' :: Maybe Text
qualificationTypeId = Maybe Text
a} :: QualificationRequest)

-- | The date and time the Qualification request had a status of Submitted.
-- This is either the time the Worker submitted answers for a Qualification
-- test, or the time the Worker requested the Qualification if the
-- Qualification type does not have a test.
qualificationRequest_submitTime :: Lens.Lens' QualificationRequest (Prelude.Maybe Prelude.UTCTime)
qualificationRequest_submitTime :: Lens' QualificationRequest (Maybe UTCTime)
qualificationRequest_submitTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QualificationRequest' {Maybe POSIX
submitTime :: Maybe POSIX
$sel:submitTime:QualificationRequest' :: QualificationRequest -> Maybe POSIX
submitTime} -> Maybe POSIX
submitTime) (\s :: QualificationRequest
s@QualificationRequest' {} Maybe POSIX
a -> QualificationRequest
s {$sel:submitTime:QualificationRequest' :: Maybe POSIX
submitTime = Maybe POSIX
a} :: QualificationRequest) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The contents of the Qualification test that was presented to the Worker,
-- if the type has a test and the Worker has submitted answers. This value
-- is identical to the QuestionForm associated with the Qualification type
-- at the time the Worker requests the Qualification.
qualificationRequest_test :: Lens.Lens' QualificationRequest (Prelude.Maybe Prelude.Text)
qualificationRequest_test :: Lens' QualificationRequest (Maybe Text)
qualificationRequest_test = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QualificationRequest' {Maybe Text
test :: Maybe Text
$sel:test:QualificationRequest' :: QualificationRequest -> Maybe Text
test} -> Maybe Text
test) (\s :: QualificationRequest
s@QualificationRequest' {} Maybe Text
a -> QualificationRequest
s {$sel:test:QualificationRequest' :: Maybe Text
test = Maybe Text
a} :: QualificationRequest)

-- | The ID of the Worker requesting the Qualification.
qualificationRequest_workerId :: Lens.Lens' QualificationRequest (Prelude.Maybe Prelude.Text)
qualificationRequest_workerId :: Lens' QualificationRequest (Maybe Text)
qualificationRequest_workerId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QualificationRequest' {Maybe Text
workerId :: Maybe Text
$sel:workerId:QualificationRequest' :: QualificationRequest -> Maybe Text
workerId} -> Maybe Text
workerId) (\s :: QualificationRequest
s@QualificationRequest' {} Maybe Text
a -> QualificationRequest
s {$sel:workerId:QualificationRequest' :: Maybe Text
workerId = Maybe Text
a} :: QualificationRequest)

instance Data.FromJSON QualificationRequest where
  parseJSON :: Value -> Parser QualificationRequest
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"QualificationRequest"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> QualificationRequest
QualificationRequest'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Answer")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"QualificationRequestId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"QualificationTypeId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"SubmitTime")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Test")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"WorkerId")
      )

instance Prelude.Hashable QualificationRequest where
  hashWithSalt :: Int -> QualificationRequest -> Int
hashWithSalt Int
_salt QualificationRequest' {Maybe Text
Maybe POSIX
workerId :: Maybe Text
test :: Maybe Text
submitTime :: Maybe POSIX
qualificationTypeId :: Maybe Text
qualificationRequestId :: Maybe Text
answer :: Maybe Text
$sel:workerId:QualificationRequest' :: QualificationRequest -> Maybe Text
$sel:test:QualificationRequest' :: QualificationRequest -> Maybe Text
$sel:submitTime:QualificationRequest' :: QualificationRequest -> Maybe POSIX
$sel:qualificationTypeId:QualificationRequest' :: QualificationRequest -> Maybe Text
$sel:qualificationRequestId:QualificationRequest' :: QualificationRequest -> Maybe Text
$sel:answer:QualificationRequest' :: QualificationRequest -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
answer
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
qualificationRequestId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
qualificationTypeId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
submitTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
test
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
workerId

instance Prelude.NFData QualificationRequest where
  rnf :: QualificationRequest -> ()
rnf QualificationRequest' {Maybe Text
Maybe POSIX
workerId :: Maybe Text
test :: Maybe Text
submitTime :: Maybe POSIX
qualificationTypeId :: Maybe Text
qualificationRequestId :: Maybe Text
answer :: Maybe Text
$sel:workerId:QualificationRequest' :: QualificationRequest -> Maybe Text
$sel:test:QualificationRequest' :: QualificationRequest -> Maybe Text
$sel:submitTime:QualificationRequest' :: QualificationRequest -> Maybe POSIX
$sel:qualificationTypeId:QualificationRequest' :: QualificationRequest -> Maybe Text
$sel:qualificationRequestId:QualificationRequest' :: QualificationRequest -> Maybe Text
$sel:answer:QualificationRequest' :: QualificationRequest -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
answer
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
qualificationRequestId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
qualificationTypeId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
submitTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
test
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
workerId