{-# 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.Assignment
-- 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.Assignment where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MechanicalTurk.Types.AssignmentStatus
import qualified Amazonka.Prelude as Prelude

-- | The Assignment data structure represents a single assignment of a HIT to
-- a Worker. The assignment tracks the Worker\'s efforts to complete the
-- HIT, and contains the results for later retrieval.
--
-- /See:/ 'newAssignment' smart constructor.
data Assignment = Assignment'
  { -- | The date and time the Worker accepted the assignment.
    Assignment -> Maybe POSIX
acceptTime :: Prelude.Maybe Core.POSIX,
    -- | The Worker\'s answers submitted for the HIT contained in a
    -- QuestionFormAnswers document, if the Worker provides an answer. If the
    -- Worker does not provide any answers, Answer may contain a
    -- QuestionFormAnswers document, or Answer may be empty.
    Assignment -> Maybe Text
answer :: Prelude.Maybe Prelude.Text,
    -- | The status of the assignment.
    Assignment -> Maybe AssignmentStatus
assignmentStatus :: Prelude.Maybe AssignmentStatus,
    -- | The feedback string included with the call to the ApproveAssignment
    -- operation or the RejectAssignment operation, if the Requester approved
    -- or rejected the assignment and specified feedback.
    Assignment -> Maybe Text
requesterFeedback :: Prelude.Maybe Prelude.Text,
    -- | The date and time of the deadline for the assignment. This value is
    -- derived from the deadline specification for the HIT and the date and
    -- time the Worker accepted the HIT.
    Assignment -> Maybe POSIX
deadline :: Prelude.Maybe Core.POSIX,
    -- | If the Worker has submitted results and the Requester has approved the
    -- results, ApprovalTime is the date and time the Requester approved the
    -- results. This value is omitted from the assignment if the Requester has
    -- not yet approved the results.
    Assignment -> Maybe POSIX
approvalTime :: Prelude.Maybe Core.POSIX,
    -- | If the Worker has submitted results and the Requester has rejected the
    -- results, RejectionTime is the date and time the Requester rejected the
    -- results.
    Assignment -> Maybe POSIX
rejectionTime :: Prelude.Maybe Core.POSIX,
    -- | If results have been submitted, AutoApprovalTime is the date and time
    -- the results of the assignment results are considered Approved
    -- automatically if they have not already been explicitly approved or
    -- rejected by the Requester. This value is derived from the auto-approval
    -- delay specified by the Requester in the HIT. This value is omitted from
    -- the assignment if the Worker has not yet submitted results.
    Assignment -> Maybe POSIX
autoApprovalTime :: Prelude.Maybe Core.POSIX,
    -- | The ID of the HIT.
    Assignment -> Maybe Text
hITId :: Prelude.Maybe Prelude.Text,
    -- | The ID of the Worker who accepted the HIT.
    Assignment -> Maybe Text
workerId :: Prelude.Maybe Prelude.Text,
    -- | A unique identifier for the assignment.
    Assignment -> Maybe Text
assignmentId :: Prelude.Maybe Prelude.Text,
    -- | If the Worker has submitted results, SubmitTime is the date and time the
    -- assignment was submitted. This value is omitted from the assignment if
    -- the Worker has not yet submitted results.
    Assignment -> Maybe POSIX
submitTime :: Prelude.Maybe Core.POSIX
  }
  deriving (Assignment -> Assignment -> Bool
(Assignment -> Assignment -> Bool)
-> (Assignment -> Assignment -> Bool) -> Eq Assignment
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Assignment -> Assignment -> Bool
$c/= :: Assignment -> Assignment -> Bool
== :: Assignment -> Assignment -> Bool
$c== :: Assignment -> Assignment -> Bool
Prelude.Eq, ReadPrec [Assignment]
ReadPrec Assignment
Int -> ReadS Assignment
ReadS [Assignment]
(Int -> ReadS Assignment)
-> ReadS [Assignment]
-> ReadPrec Assignment
-> ReadPrec [Assignment]
-> Read Assignment
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Assignment]
$creadListPrec :: ReadPrec [Assignment]
readPrec :: ReadPrec Assignment
$creadPrec :: ReadPrec Assignment
readList :: ReadS [Assignment]
$creadList :: ReadS [Assignment]
readsPrec :: Int -> ReadS Assignment
$creadsPrec :: Int -> ReadS Assignment
Prelude.Read, Int -> Assignment -> ShowS
[Assignment] -> ShowS
Assignment -> String
(Int -> Assignment -> ShowS)
-> (Assignment -> String)
-> ([Assignment] -> ShowS)
-> Show Assignment
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Assignment] -> ShowS
$cshowList :: [Assignment] -> ShowS
show :: Assignment -> String
$cshow :: Assignment -> String
showsPrec :: Int -> Assignment -> ShowS
$cshowsPrec :: Int -> Assignment -> ShowS
Prelude.Show, (forall x. Assignment -> Rep Assignment x)
-> (forall x. Rep Assignment x -> Assignment) -> Generic Assignment
forall x. Rep Assignment x -> Assignment
forall x. Assignment -> Rep Assignment x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Assignment x -> Assignment
$cfrom :: forall x. Assignment -> Rep Assignment x
Prelude.Generic)

-- |
-- Create a value of 'Assignment' 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:
--
-- 'acceptTime', 'assignment_acceptTime' - The date and time the Worker accepted the assignment.
--
-- 'answer', 'assignment_answer' - The Worker\'s answers submitted for the HIT contained in a
-- QuestionFormAnswers document, if the Worker provides an answer. If the
-- Worker does not provide any answers, Answer may contain a
-- QuestionFormAnswers document, or Answer may be empty.
--
-- 'assignmentStatus', 'assignment_assignmentStatus' - The status of the assignment.
--
-- 'requesterFeedback', 'assignment_requesterFeedback' - The feedback string included with the call to the ApproveAssignment
-- operation or the RejectAssignment operation, if the Requester approved
-- or rejected the assignment and specified feedback.
--
-- 'deadline', 'assignment_deadline' - The date and time of the deadline for the assignment. This value is
-- derived from the deadline specification for the HIT and the date and
-- time the Worker accepted the HIT.
--
-- 'approvalTime', 'assignment_approvalTime' - If the Worker has submitted results and the Requester has approved the
-- results, ApprovalTime is the date and time the Requester approved the
-- results. This value is omitted from the assignment if the Requester has
-- not yet approved the results.
--
-- 'rejectionTime', 'assignment_rejectionTime' - If the Worker has submitted results and the Requester has rejected the
-- results, RejectionTime is the date and time the Requester rejected the
-- results.
--
-- 'autoApprovalTime', 'assignment_autoApprovalTime' - If results have been submitted, AutoApprovalTime is the date and time
-- the results of the assignment results are considered Approved
-- automatically if they have not already been explicitly approved or
-- rejected by the Requester. This value is derived from the auto-approval
-- delay specified by the Requester in the HIT. This value is omitted from
-- the assignment if the Worker has not yet submitted results.
--
-- 'hITId', 'assignment_hITId' - The ID of the HIT.
--
-- 'workerId', 'assignment_workerId' - The ID of the Worker who accepted the HIT.
--
-- 'assignmentId', 'assignment_assignmentId' - A unique identifier for the assignment.
--
-- 'submitTime', 'assignment_submitTime' - If the Worker has submitted results, SubmitTime is the date and time the
-- assignment was submitted. This value is omitted from the assignment if
-- the Worker has not yet submitted results.
newAssignment ::
  Assignment
newAssignment :: Assignment
newAssignment =
  Assignment' :: Maybe POSIX
-> Maybe Text
-> Maybe AssignmentStatus
-> Maybe Text
-> Maybe POSIX
-> Maybe POSIX
-> Maybe POSIX
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Assignment
Assignment'
    { $sel:acceptTime:Assignment' :: Maybe POSIX
acceptTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:answer:Assignment' :: Maybe Text
answer = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:assignmentStatus:Assignment' :: Maybe AssignmentStatus
assignmentStatus = Maybe AssignmentStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:requesterFeedback:Assignment' :: Maybe Text
requesterFeedback = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:deadline:Assignment' :: Maybe POSIX
deadline = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:approvalTime:Assignment' :: Maybe POSIX
approvalTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:rejectionTime:Assignment' :: Maybe POSIX
rejectionTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:autoApprovalTime:Assignment' :: Maybe POSIX
autoApprovalTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:hITId:Assignment' :: Maybe Text
hITId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:workerId:Assignment' :: Maybe Text
workerId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:assignmentId:Assignment' :: Maybe Text
assignmentId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:submitTime:Assignment' :: Maybe POSIX
submitTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
    }

-- | The date and time the Worker accepted the assignment.
assignment_acceptTime :: Lens.Lens' Assignment (Prelude.Maybe Prelude.UTCTime)
assignment_acceptTime :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Assignment -> f Assignment
assignment_acceptTime = (Assignment -> Maybe POSIX)
-> (Assignment -> Maybe POSIX -> Assignment)
-> Lens Assignment Assignment (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Assignment' {Maybe POSIX
acceptTime :: Maybe POSIX
$sel:acceptTime:Assignment' :: Assignment -> Maybe POSIX
acceptTime} -> Maybe POSIX
acceptTime) (\s :: Assignment
s@Assignment' {} Maybe POSIX
a -> Assignment
s {$sel:acceptTime:Assignment' :: Maybe POSIX
acceptTime = Maybe POSIX
a} :: Assignment) ((Maybe POSIX -> f (Maybe POSIX)) -> Assignment -> f Assignment)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Assignment
-> f Assignment
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The Worker\'s answers submitted for the HIT contained in a
-- QuestionFormAnswers document, if the Worker provides an answer. If the
-- Worker does not provide any answers, Answer may contain a
-- QuestionFormAnswers document, or Answer may be empty.
assignment_answer :: Lens.Lens' Assignment (Prelude.Maybe Prelude.Text)
assignment_answer :: (Maybe Text -> f (Maybe Text)) -> Assignment -> f Assignment
assignment_answer = (Assignment -> Maybe Text)
-> (Assignment -> Maybe Text -> Assignment)
-> Lens Assignment Assignment (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Assignment' {Maybe Text
answer :: Maybe Text
$sel:answer:Assignment' :: Assignment -> Maybe Text
answer} -> Maybe Text
answer) (\s :: Assignment
s@Assignment' {} Maybe Text
a -> Assignment
s {$sel:answer:Assignment' :: Maybe Text
answer = Maybe Text
a} :: Assignment)

-- | The status of the assignment.
assignment_assignmentStatus :: Lens.Lens' Assignment (Prelude.Maybe AssignmentStatus)
assignment_assignmentStatus :: (Maybe AssignmentStatus -> f (Maybe AssignmentStatus))
-> Assignment -> f Assignment
assignment_assignmentStatus = (Assignment -> Maybe AssignmentStatus)
-> (Assignment -> Maybe AssignmentStatus -> Assignment)
-> Lens
     Assignment
     Assignment
     (Maybe AssignmentStatus)
     (Maybe AssignmentStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Assignment' {Maybe AssignmentStatus
assignmentStatus :: Maybe AssignmentStatus
$sel:assignmentStatus:Assignment' :: Assignment -> Maybe AssignmentStatus
assignmentStatus} -> Maybe AssignmentStatus
assignmentStatus) (\s :: Assignment
s@Assignment' {} Maybe AssignmentStatus
a -> Assignment
s {$sel:assignmentStatus:Assignment' :: Maybe AssignmentStatus
assignmentStatus = Maybe AssignmentStatus
a} :: Assignment)

-- | The feedback string included with the call to the ApproveAssignment
-- operation or the RejectAssignment operation, if the Requester approved
-- or rejected the assignment and specified feedback.
assignment_requesterFeedback :: Lens.Lens' Assignment (Prelude.Maybe Prelude.Text)
assignment_requesterFeedback :: (Maybe Text -> f (Maybe Text)) -> Assignment -> f Assignment
assignment_requesterFeedback = (Assignment -> Maybe Text)
-> (Assignment -> Maybe Text -> Assignment)
-> Lens Assignment Assignment (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Assignment' {Maybe Text
requesterFeedback :: Maybe Text
$sel:requesterFeedback:Assignment' :: Assignment -> Maybe Text
requesterFeedback} -> Maybe Text
requesterFeedback) (\s :: Assignment
s@Assignment' {} Maybe Text
a -> Assignment
s {$sel:requesterFeedback:Assignment' :: Maybe Text
requesterFeedback = Maybe Text
a} :: Assignment)

-- | The date and time of the deadline for the assignment. This value is
-- derived from the deadline specification for the HIT and the date and
-- time the Worker accepted the HIT.
assignment_deadline :: Lens.Lens' Assignment (Prelude.Maybe Prelude.UTCTime)
assignment_deadline :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Assignment -> f Assignment
assignment_deadline = (Assignment -> Maybe POSIX)
-> (Assignment -> Maybe POSIX -> Assignment)
-> Lens Assignment Assignment (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Assignment' {Maybe POSIX
deadline :: Maybe POSIX
$sel:deadline:Assignment' :: Assignment -> Maybe POSIX
deadline} -> Maybe POSIX
deadline) (\s :: Assignment
s@Assignment' {} Maybe POSIX
a -> Assignment
s {$sel:deadline:Assignment' :: Maybe POSIX
deadline = Maybe POSIX
a} :: Assignment) ((Maybe POSIX -> f (Maybe POSIX)) -> Assignment -> f Assignment)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Assignment
-> f Assignment
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | If the Worker has submitted results and the Requester has approved the
-- results, ApprovalTime is the date and time the Requester approved the
-- results. This value is omitted from the assignment if the Requester has
-- not yet approved the results.
assignment_approvalTime :: Lens.Lens' Assignment (Prelude.Maybe Prelude.UTCTime)
assignment_approvalTime :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Assignment -> f Assignment
assignment_approvalTime = (Assignment -> Maybe POSIX)
-> (Assignment -> Maybe POSIX -> Assignment)
-> Lens Assignment Assignment (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Assignment' {Maybe POSIX
approvalTime :: Maybe POSIX
$sel:approvalTime:Assignment' :: Assignment -> Maybe POSIX
approvalTime} -> Maybe POSIX
approvalTime) (\s :: Assignment
s@Assignment' {} Maybe POSIX
a -> Assignment
s {$sel:approvalTime:Assignment' :: Maybe POSIX
approvalTime = Maybe POSIX
a} :: Assignment) ((Maybe POSIX -> f (Maybe POSIX)) -> Assignment -> f Assignment)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Assignment
-> f Assignment
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | If the Worker has submitted results and the Requester has rejected the
-- results, RejectionTime is the date and time the Requester rejected the
-- results.
assignment_rejectionTime :: Lens.Lens' Assignment (Prelude.Maybe Prelude.UTCTime)
assignment_rejectionTime :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Assignment -> f Assignment
assignment_rejectionTime = (Assignment -> Maybe POSIX)
-> (Assignment -> Maybe POSIX -> Assignment)
-> Lens Assignment Assignment (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Assignment' {Maybe POSIX
rejectionTime :: Maybe POSIX
$sel:rejectionTime:Assignment' :: Assignment -> Maybe POSIX
rejectionTime} -> Maybe POSIX
rejectionTime) (\s :: Assignment
s@Assignment' {} Maybe POSIX
a -> Assignment
s {$sel:rejectionTime:Assignment' :: Maybe POSIX
rejectionTime = Maybe POSIX
a} :: Assignment) ((Maybe POSIX -> f (Maybe POSIX)) -> Assignment -> f Assignment)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Assignment
-> f Assignment
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | If results have been submitted, AutoApprovalTime is the date and time
-- the results of the assignment results are considered Approved
-- automatically if they have not already been explicitly approved or
-- rejected by the Requester. This value is derived from the auto-approval
-- delay specified by the Requester in the HIT. This value is omitted from
-- the assignment if the Worker has not yet submitted results.
assignment_autoApprovalTime :: Lens.Lens' Assignment (Prelude.Maybe Prelude.UTCTime)
assignment_autoApprovalTime :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Assignment -> f Assignment
assignment_autoApprovalTime = (Assignment -> Maybe POSIX)
-> (Assignment -> Maybe POSIX -> Assignment)
-> Lens Assignment Assignment (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Assignment' {Maybe POSIX
autoApprovalTime :: Maybe POSIX
$sel:autoApprovalTime:Assignment' :: Assignment -> Maybe POSIX
autoApprovalTime} -> Maybe POSIX
autoApprovalTime) (\s :: Assignment
s@Assignment' {} Maybe POSIX
a -> Assignment
s {$sel:autoApprovalTime:Assignment' :: Maybe POSIX
autoApprovalTime = Maybe POSIX
a} :: Assignment) ((Maybe POSIX -> f (Maybe POSIX)) -> Assignment -> f Assignment)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Assignment
-> f Assignment
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The ID of the HIT.
assignment_hITId :: Lens.Lens' Assignment (Prelude.Maybe Prelude.Text)
assignment_hITId :: (Maybe Text -> f (Maybe Text)) -> Assignment -> f Assignment
assignment_hITId = (Assignment -> Maybe Text)
-> (Assignment -> Maybe Text -> Assignment)
-> Lens Assignment Assignment (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Assignment' {Maybe Text
hITId :: Maybe Text
$sel:hITId:Assignment' :: Assignment -> Maybe Text
hITId} -> Maybe Text
hITId) (\s :: Assignment
s@Assignment' {} Maybe Text
a -> Assignment
s {$sel:hITId:Assignment' :: Maybe Text
hITId = Maybe Text
a} :: Assignment)

-- | The ID of the Worker who accepted the HIT.
assignment_workerId :: Lens.Lens' Assignment (Prelude.Maybe Prelude.Text)
assignment_workerId :: (Maybe Text -> f (Maybe Text)) -> Assignment -> f Assignment
assignment_workerId = (Assignment -> Maybe Text)
-> (Assignment -> Maybe Text -> Assignment)
-> Lens Assignment Assignment (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Assignment' {Maybe Text
workerId :: Maybe Text
$sel:workerId:Assignment' :: Assignment -> Maybe Text
workerId} -> Maybe Text
workerId) (\s :: Assignment
s@Assignment' {} Maybe Text
a -> Assignment
s {$sel:workerId:Assignment' :: Maybe Text
workerId = Maybe Text
a} :: Assignment)

-- | A unique identifier for the assignment.
assignment_assignmentId :: Lens.Lens' Assignment (Prelude.Maybe Prelude.Text)
assignment_assignmentId :: (Maybe Text -> f (Maybe Text)) -> Assignment -> f Assignment
assignment_assignmentId = (Assignment -> Maybe Text)
-> (Assignment -> Maybe Text -> Assignment)
-> Lens Assignment Assignment (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Assignment' {Maybe Text
assignmentId :: Maybe Text
$sel:assignmentId:Assignment' :: Assignment -> Maybe Text
assignmentId} -> Maybe Text
assignmentId) (\s :: Assignment
s@Assignment' {} Maybe Text
a -> Assignment
s {$sel:assignmentId:Assignment' :: Maybe Text
assignmentId = Maybe Text
a} :: Assignment)

-- | If the Worker has submitted results, SubmitTime is the date and time the
-- assignment was submitted. This value is omitted from the assignment if
-- the Worker has not yet submitted results.
assignment_submitTime :: Lens.Lens' Assignment (Prelude.Maybe Prelude.UTCTime)
assignment_submitTime :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Assignment -> f Assignment
assignment_submitTime = (Assignment -> Maybe POSIX)
-> (Assignment -> Maybe POSIX -> Assignment)
-> Lens Assignment Assignment (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Assignment' {Maybe POSIX
submitTime :: Maybe POSIX
$sel:submitTime:Assignment' :: Assignment -> Maybe POSIX
submitTime} -> Maybe POSIX
submitTime) (\s :: Assignment
s@Assignment' {} Maybe POSIX
a -> Assignment
s {$sel:submitTime:Assignment' :: Maybe POSIX
submitTime = Maybe POSIX
a} :: Assignment) ((Maybe POSIX -> f (Maybe POSIX)) -> Assignment -> f Assignment)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Assignment
-> f Assignment
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

instance Core.FromJSON Assignment where
  parseJSON :: Value -> Parser Assignment
parseJSON =
    String
-> (Object -> Parser Assignment) -> Value -> Parser Assignment
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Assignment"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Text
-> Maybe AssignmentStatus
-> Maybe Text
-> Maybe POSIX
-> Maybe POSIX
-> Maybe POSIX
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Assignment
Assignment'
            (Maybe POSIX
 -> Maybe Text
 -> Maybe AssignmentStatus
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe POSIX
 -> Maybe POSIX
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe POSIX
 -> Assignment)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text
      -> Maybe AssignmentStatus
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe POSIX
      -> Maybe POSIX
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Assignment)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AcceptTime")
            Parser
  (Maybe Text
   -> Maybe AssignmentStatus
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe POSIX
   -> Maybe POSIX
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> Assignment)
-> Parser (Maybe Text)
-> Parser
     (Maybe AssignmentStatus
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe POSIX
      -> Maybe POSIX
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Assignment)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Answer")
            Parser
  (Maybe AssignmentStatus
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe POSIX
   -> Maybe POSIX
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> Assignment)
-> Parser (Maybe AssignmentStatus)
-> Parser
     (Maybe Text
      -> Maybe POSIX
      -> Maybe POSIX
      -> Maybe POSIX
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Assignment)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe AssignmentStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AssignmentStatus")
            Parser
  (Maybe Text
   -> Maybe POSIX
   -> Maybe POSIX
   -> Maybe POSIX
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> Assignment)
-> Parser (Maybe Text)
-> Parser
     (Maybe POSIX
      -> Maybe POSIX
      -> Maybe POSIX
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Assignment)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RequesterFeedback")
            Parser
  (Maybe POSIX
   -> Maybe POSIX
   -> Maybe POSIX
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> Assignment)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe POSIX
      -> Maybe POSIX
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Assignment)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Deadline")
            Parser
  (Maybe POSIX
   -> Maybe POSIX
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> Assignment)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe POSIX
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Assignment)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ApprovalTime")
            Parser
  (Maybe POSIX
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> Assignment)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Assignment)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RejectionTime")
            Parser
  (Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> Assignment)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe Text -> Maybe POSIX -> Assignment)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AutoApprovalTime")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe Text -> Maybe POSIX -> Assignment)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> Maybe POSIX -> Assignment)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"HITId")
            Parser (Maybe Text -> Maybe Text -> Maybe POSIX -> Assignment)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe POSIX -> Assignment)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"WorkerId")
            Parser (Maybe Text -> Maybe POSIX -> Assignment)
-> Parser (Maybe Text) -> Parser (Maybe POSIX -> Assignment)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AssignmentId")
            Parser (Maybe POSIX -> Assignment)
-> Parser (Maybe POSIX) -> Parser Assignment
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SubmitTime")
      )

instance Prelude.Hashable Assignment

instance Prelude.NFData Assignment