{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# 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.CreateHIT
-- 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)
--
-- The @CreateHIT@ operation creates a new Human Intelligence Task (HIT).
-- The new HIT is made available for Workers to find and accept on the
-- Amazon Mechanical Turk website.
--
-- This operation allows you to specify a new HIT by passing in values for
-- the properties of the HIT, such as its title, reward amount and number
-- of assignments. When you pass these values to @CreateHIT@, a new HIT is
-- created for you, with a new @HITTypeID@. The HITTypeID can be used to
-- create additional HITs in the future without needing to specify common
-- parameters such as the title, description and reward amount each time.
--
-- An alternative way to create HITs is to first generate a HITTypeID using
-- the @CreateHITType@ operation and then call the @CreateHITWithHITType@
-- operation. This is the recommended best practice for Requesters who are
-- creating large numbers of HITs.
--
-- CreateHIT also supports several ways to provide question data: by
-- providing a value for the @Question@ parameter that fully specifies the
-- contents of the HIT, or by providing a @HitLayoutId@ and associated
-- @HitLayoutParameters@.
--
-- If a HIT is created with 10 or more maximum assignments, there is an
-- additional fee. For more information, see
-- <https://requester.mturk.com/pricing Amazon Mechanical Turk Pricing>.
module Amazonka.MechanicalTurk.CreateHIT
  ( -- * Creating a Request
    CreateHIT (..),
    newCreateHIT,

    -- * Request Lenses
    createHIT_hITReviewPolicy,
    createHIT_uniqueRequestToken,
    createHIT_autoApprovalDelayInSeconds,
    createHIT_requesterAnnotation,
    createHIT_maxAssignments,
    createHIT_keywords,
    createHIT_hITLayoutId,
    createHIT_hITLayoutParameters,
    createHIT_qualificationRequirements,
    createHIT_question,
    createHIT_assignmentReviewPolicy,
    createHIT_lifetimeInSeconds,
    createHIT_assignmentDurationInSeconds,
    createHIT_reward,
    createHIT_title,
    createHIT_description,

    -- * Destructuring the Response
    CreateHITResponse (..),
    newCreateHITResponse,

    -- * Response Lenses
    createHITResponse_hit,
    createHITResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MechanicalTurk.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newCreateHIT' smart constructor.
data CreateHIT = CreateHIT'
  { -- | The HIT-level Review Policy applies to the HIT. You can specify for
    -- Mechanical Turk to take various actions based on the policy.
    CreateHIT -> Maybe ReviewPolicy
hITReviewPolicy :: Prelude.Maybe ReviewPolicy,
    -- | A unique identifier for this request which allows you to retry the call
    -- on error without creating duplicate HITs. This is useful in cases such
    -- as network timeouts where it is unclear whether or not the call
    -- succeeded on the server. If the HIT already exists in the system from a
    -- previous call using the same UniqueRequestToken, subsequent calls will
    -- return a AWS.MechanicalTurk.HitAlreadyExists error with a message
    -- containing the HITId.
    --
    -- Note: It is your responsibility to ensure uniqueness of the token. The
    -- unique token expires after 24 hours. Subsequent calls using the same
    -- UniqueRequestToken made after the 24 hour limit could create duplicate
    -- HITs.
    CreateHIT -> Maybe Text
uniqueRequestToken :: Prelude.Maybe Prelude.Text,
    -- | The number of seconds after an assignment for the HIT has been
    -- submitted, after which the assignment is considered Approved
    -- automatically unless the Requester explicitly rejects it.
    CreateHIT -> Maybe Integer
autoApprovalDelayInSeconds :: Prelude.Maybe Prelude.Integer,
    -- | An arbitrary data field. The RequesterAnnotation parameter lets your
    -- application attach arbitrary data to the HIT for tracking purposes. For
    -- example, this parameter could be an identifier internal to the
    -- Requester\'s application that corresponds with the HIT.
    --
    -- The RequesterAnnotation parameter for a HIT is only visible to the
    -- Requester who created the HIT. It is not shown to the Worker, or any
    -- other Requester.
    --
    -- The RequesterAnnotation parameter may be different for each HIT you
    -- submit. It does not affect how your HITs are grouped.
    CreateHIT -> Maybe Text
requesterAnnotation :: Prelude.Maybe Prelude.Text,
    -- | The number of times the HIT can be accepted and completed before the HIT
    -- becomes unavailable.
    CreateHIT -> Maybe Int
maxAssignments :: Prelude.Maybe Prelude.Int,
    -- | One or more words or phrases that describe the HIT, separated by commas.
    -- These words are used in searches to find HITs.
    CreateHIT -> Maybe Text
keywords :: Prelude.Maybe Prelude.Text,
    -- | The HITLayoutId allows you to use a pre-existing HIT design with
    -- placeholder values and create an additional HIT by providing those
    -- values as HITLayoutParameters.
    --
    -- Constraints: Either a Question parameter or a HITLayoutId parameter must
    -- be provided.
    CreateHIT -> Maybe Text
hITLayoutId :: Prelude.Maybe Prelude.Text,
    -- | If the HITLayoutId is provided, any placeholder values must be filled in
    -- with values using the HITLayoutParameter structure. For more
    -- information, see HITLayout.
    CreateHIT -> Maybe [HITLayoutParameter]
hITLayoutParameters :: Prelude.Maybe [HITLayoutParameter],
    -- | Conditions that a Worker\'s Qualifications must meet in order to accept
    -- the HIT. A HIT can have between zero and ten Qualification requirements.
    -- All requirements must be met in order for a Worker to accept the HIT.
    -- Additionally, other actions can be restricted using the @ActionsGuarded@
    -- field on each @QualificationRequirement@ structure.
    CreateHIT -> Maybe [QualificationRequirement]
qualificationRequirements :: Prelude.Maybe [QualificationRequirement],
    -- | The data the person completing the HIT uses to produce the results.
    --
    -- Constraints: Must be a QuestionForm data structure, an ExternalQuestion
    -- data structure, or an HTMLQuestion data structure. The XML question data
    -- must not be larger than 64 kilobytes (65,535 bytes) in size, including
    -- whitespace.
    --
    -- Either a Question parameter or a HITLayoutId parameter must be provided.
    CreateHIT -> Maybe Text
question :: Prelude.Maybe Prelude.Text,
    -- | The Assignment-level Review Policy applies to the assignments under the
    -- HIT. You can specify for Mechanical Turk to take various actions based
    -- on the policy.
    CreateHIT -> Maybe ReviewPolicy
assignmentReviewPolicy :: Prelude.Maybe ReviewPolicy,
    -- | An amount of time, in seconds, after which the HIT is no longer
    -- available for users to accept. After the lifetime of the HIT elapses,
    -- the HIT no longer appears in HIT searches, even if not all of the
    -- assignments for the HIT have been accepted.
    CreateHIT -> Integer
lifetimeInSeconds :: Prelude.Integer,
    -- | The amount of time, in seconds, that a Worker has to complete the HIT
    -- after accepting it. If a Worker does not complete the assignment within
    -- the specified duration, the assignment is considered abandoned. If the
    -- HIT is still active (that is, its lifetime has not elapsed), the
    -- assignment becomes available for other users to find and accept.
    CreateHIT -> Integer
assignmentDurationInSeconds :: Prelude.Integer,
    -- | The amount of money the Requester will pay a Worker for successfully
    -- completing the HIT.
    CreateHIT -> Text
reward :: Prelude.Text,
    -- | The title of the HIT. A title should be short and descriptive about the
    -- kind of task the HIT contains. On the Amazon Mechanical Turk web site,
    -- the HIT title appears in search results, and everywhere the HIT is
    -- mentioned.
    CreateHIT -> Text
title :: Prelude.Text,
    -- | A general description of the HIT. A description includes detailed
    -- information about the kind of task the HIT contains. On the Amazon
    -- Mechanical Turk web site, the HIT description appears in the expanded
    -- view of search results, and in the HIT and assignment screens. A good
    -- description gives the user enough information to evaluate the HIT before
    -- accepting it.
    CreateHIT -> Text
description :: Prelude.Text
  }
  deriving (CreateHIT -> CreateHIT -> Bool
(CreateHIT -> CreateHIT -> Bool)
-> (CreateHIT -> CreateHIT -> Bool) -> Eq CreateHIT
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateHIT -> CreateHIT -> Bool
$c/= :: CreateHIT -> CreateHIT -> Bool
== :: CreateHIT -> CreateHIT -> Bool
$c== :: CreateHIT -> CreateHIT -> Bool
Prelude.Eq, ReadPrec [CreateHIT]
ReadPrec CreateHIT
Int -> ReadS CreateHIT
ReadS [CreateHIT]
(Int -> ReadS CreateHIT)
-> ReadS [CreateHIT]
-> ReadPrec CreateHIT
-> ReadPrec [CreateHIT]
-> Read CreateHIT
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateHIT]
$creadListPrec :: ReadPrec [CreateHIT]
readPrec :: ReadPrec CreateHIT
$creadPrec :: ReadPrec CreateHIT
readList :: ReadS [CreateHIT]
$creadList :: ReadS [CreateHIT]
readsPrec :: Int -> ReadS CreateHIT
$creadsPrec :: Int -> ReadS CreateHIT
Prelude.Read, Int -> CreateHIT -> ShowS
[CreateHIT] -> ShowS
CreateHIT -> String
(Int -> CreateHIT -> ShowS)
-> (CreateHIT -> String)
-> ([CreateHIT] -> ShowS)
-> Show CreateHIT
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateHIT] -> ShowS
$cshowList :: [CreateHIT] -> ShowS
show :: CreateHIT -> String
$cshow :: CreateHIT -> String
showsPrec :: Int -> CreateHIT -> ShowS
$cshowsPrec :: Int -> CreateHIT -> ShowS
Prelude.Show, (forall x. CreateHIT -> Rep CreateHIT x)
-> (forall x. Rep CreateHIT x -> CreateHIT) -> Generic CreateHIT
forall x. Rep CreateHIT x -> CreateHIT
forall x. CreateHIT -> Rep CreateHIT x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateHIT x -> CreateHIT
$cfrom :: forall x. CreateHIT -> Rep CreateHIT x
Prelude.Generic)

-- |
-- Create a value of 'CreateHIT' 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:
--
-- 'hITReviewPolicy', 'createHIT_hITReviewPolicy' - The HIT-level Review Policy applies to the HIT. You can specify for
-- Mechanical Turk to take various actions based on the policy.
--
-- 'uniqueRequestToken', 'createHIT_uniqueRequestToken' - A unique identifier for this request which allows you to retry the call
-- on error without creating duplicate HITs. This is useful in cases such
-- as network timeouts where it is unclear whether or not the call
-- succeeded on the server. If the HIT already exists in the system from a
-- previous call using the same UniqueRequestToken, subsequent calls will
-- return a AWS.MechanicalTurk.HitAlreadyExists error with a message
-- containing the HITId.
--
-- Note: It is your responsibility to ensure uniqueness of the token. The
-- unique token expires after 24 hours. Subsequent calls using the same
-- UniqueRequestToken made after the 24 hour limit could create duplicate
-- HITs.
--
-- 'autoApprovalDelayInSeconds', 'createHIT_autoApprovalDelayInSeconds' - The number of seconds after an assignment for the HIT has been
-- submitted, after which the assignment is considered Approved
-- automatically unless the Requester explicitly rejects it.
--
-- 'requesterAnnotation', 'createHIT_requesterAnnotation' - An arbitrary data field. The RequesterAnnotation parameter lets your
-- application attach arbitrary data to the HIT for tracking purposes. For
-- example, this parameter could be an identifier internal to the
-- Requester\'s application that corresponds with the HIT.
--
-- The RequesterAnnotation parameter for a HIT is only visible to the
-- Requester who created the HIT. It is not shown to the Worker, or any
-- other Requester.
--
-- The RequesterAnnotation parameter may be different for each HIT you
-- submit. It does not affect how your HITs are grouped.
--
-- 'maxAssignments', 'createHIT_maxAssignments' - The number of times the HIT can be accepted and completed before the HIT
-- becomes unavailable.
--
-- 'keywords', 'createHIT_keywords' - One or more words or phrases that describe the HIT, separated by commas.
-- These words are used in searches to find HITs.
--
-- 'hITLayoutId', 'createHIT_hITLayoutId' - The HITLayoutId allows you to use a pre-existing HIT design with
-- placeholder values and create an additional HIT by providing those
-- values as HITLayoutParameters.
--
-- Constraints: Either a Question parameter or a HITLayoutId parameter must
-- be provided.
--
-- 'hITLayoutParameters', 'createHIT_hITLayoutParameters' - If the HITLayoutId is provided, any placeholder values must be filled in
-- with values using the HITLayoutParameter structure. For more
-- information, see HITLayout.
--
-- 'qualificationRequirements', 'createHIT_qualificationRequirements' - Conditions that a Worker\'s Qualifications must meet in order to accept
-- the HIT. A HIT can have between zero and ten Qualification requirements.
-- All requirements must be met in order for a Worker to accept the HIT.
-- Additionally, other actions can be restricted using the @ActionsGuarded@
-- field on each @QualificationRequirement@ structure.
--
-- 'question', 'createHIT_question' - The data the person completing the HIT uses to produce the results.
--
-- Constraints: Must be a QuestionForm data structure, an ExternalQuestion
-- data structure, or an HTMLQuestion data structure. The XML question data
-- must not be larger than 64 kilobytes (65,535 bytes) in size, including
-- whitespace.
--
-- Either a Question parameter or a HITLayoutId parameter must be provided.
--
-- 'assignmentReviewPolicy', 'createHIT_assignmentReviewPolicy' - The Assignment-level Review Policy applies to the assignments under the
-- HIT. You can specify for Mechanical Turk to take various actions based
-- on the policy.
--
-- 'lifetimeInSeconds', 'createHIT_lifetimeInSeconds' - An amount of time, in seconds, after which the HIT is no longer
-- available for users to accept. After the lifetime of the HIT elapses,
-- the HIT no longer appears in HIT searches, even if not all of the
-- assignments for the HIT have been accepted.
--
-- 'assignmentDurationInSeconds', 'createHIT_assignmentDurationInSeconds' - The amount of time, in seconds, that a Worker has to complete the HIT
-- after accepting it. If a Worker does not complete the assignment within
-- the specified duration, the assignment is considered abandoned. If the
-- HIT is still active (that is, its lifetime has not elapsed), the
-- assignment becomes available for other users to find and accept.
--
-- 'reward', 'createHIT_reward' - The amount of money the Requester will pay a Worker for successfully
-- completing the HIT.
--
-- 'title', 'createHIT_title' - The title of the HIT. A title should be short and descriptive about the
-- kind of task the HIT contains. On the Amazon Mechanical Turk web site,
-- the HIT title appears in search results, and everywhere the HIT is
-- mentioned.
--
-- 'description', 'createHIT_description' - A general description of the HIT. A description includes detailed
-- information about the kind of task the HIT contains. On the Amazon
-- Mechanical Turk web site, the HIT description appears in the expanded
-- view of search results, and in the HIT and assignment screens. A good
-- description gives the user enough information to evaluate the HIT before
-- accepting it.
newCreateHIT ::
  -- | 'lifetimeInSeconds'
  Prelude.Integer ->
  -- | 'assignmentDurationInSeconds'
  Prelude.Integer ->
  -- | 'reward'
  Prelude.Text ->
  -- | 'title'
  Prelude.Text ->
  -- | 'description'
  Prelude.Text ->
  CreateHIT
newCreateHIT :: Integer -> Integer -> Text -> Text -> Text -> CreateHIT
newCreateHIT
  Integer
pLifetimeInSeconds_
  Integer
pAssignmentDurationInSeconds_
  Text
pReward_
  Text
pTitle_
  Text
pDescription_ =
    CreateHIT' :: Maybe ReviewPolicy
-> Maybe Text
-> Maybe Integer
-> Maybe Text
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe [HITLayoutParameter]
-> Maybe [QualificationRequirement]
-> Maybe Text
-> Maybe ReviewPolicy
-> Integer
-> Integer
-> Text
-> Text
-> Text
-> CreateHIT
CreateHIT'
      { $sel:hITReviewPolicy:CreateHIT' :: Maybe ReviewPolicy
hITReviewPolicy = Maybe ReviewPolicy
forall a. Maybe a
Prelude.Nothing,
        $sel:uniqueRequestToken:CreateHIT' :: Maybe Text
uniqueRequestToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:autoApprovalDelayInSeconds:CreateHIT' :: Maybe Integer
autoApprovalDelayInSeconds = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
        $sel:requesterAnnotation:CreateHIT' :: Maybe Text
requesterAnnotation = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:maxAssignments:CreateHIT' :: Maybe Int
maxAssignments = Maybe Int
forall a. Maybe a
Prelude.Nothing,
        $sel:keywords:CreateHIT' :: Maybe Text
keywords = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:hITLayoutId:CreateHIT' :: Maybe Text
hITLayoutId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:hITLayoutParameters:CreateHIT' :: Maybe [HITLayoutParameter]
hITLayoutParameters = Maybe [HITLayoutParameter]
forall a. Maybe a
Prelude.Nothing,
        $sel:qualificationRequirements:CreateHIT' :: Maybe [QualificationRequirement]
qualificationRequirements = Maybe [QualificationRequirement]
forall a. Maybe a
Prelude.Nothing,
        $sel:question:CreateHIT' :: Maybe Text
question = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:assignmentReviewPolicy:CreateHIT' :: Maybe ReviewPolicy
assignmentReviewPolicy = Maybe ReviewPolicy
forall a. Maybe a
Prelude.Nothing,
        $sel:lifetimeInSeconds:CreateHIT' :: Integer
lifetimeInSeconds = Integer
pLifetimeInSeconds_,
        $sel:assignmentDurationInSeconds:CreateHIT' :: Integer
assignmentDurationInSeconds =
          Integer
pAssignmentDurationInSeconds_,
        $sel:reward:CreateHIT' :: Text
reward = Text
pReward_,
        $sel:title:CreateHIT' :: Text
title = Text
pTitle_,
        $sel:description:CreateHIT' :: Text
description = Text
pDescription_
      }

-- | The HIT-level Review Policy applies to the HIT. You can specify for
-- Mechanical Turk to take various actions based on the policy.
createHIT_hITReviewPolicy :: Lens.Lens' CreateHIT (Prelude.Maybe ReviewPolicy)
createHIT_hITReviewPolicy :: (Maybe ReviewPolicy -> f (Maybe ReviewPolicy))
-> CreateHIT -> f CreateHIT
createHIT_hITReviewPolicy = (CreateHIT -> Maybe ReviewPolicy)
-> (CreateHIT -> Maybe ReviewPolicy -> CreateHIT)
-> Lens
     CreateHIT CreateHIT (Maybe ReviewPolicy) (Maybe ReviewPolicy)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHIT' {Maybe ReviewPolicy
hITReviewPolicy :: Maybe ReviewPolicy
$sel:hITReviewPolicy:CreateHIT' :: CreateHIT -> Maybe ReviewPolicy
hITReviewPolicy} -> Maybe ReviewPolicy
hITReviewPolicy) (\s :: CreateHIT
s@CreateHIT' {} Maybe ReviewPolicy
a -> CreateHIT
s {$sel:hITReviewPolicy:CreateHIT' :: Maybe ReviewPolicy
hITReviewPolicy = Maybe ReviewPolicy
a} :: CreateHIT)

-- | A unique identifier for this request which allows you to retry the call
-- on error without creating duplicate HITs. This is useful in cases such
-- as network timeouts where it is unclear whether or not the call
-- succeeded on the server. If the HIT already exists in the system from a
-- previous call using the same UniqueRequestToken, subsequent calls will
-- return a AWS.MechanicalTurk.HitAlreadyExists error with a message
-- containing the HITId.
--
-- Note: It is your responsibility to ensure uniqueness of the token. The
-- unique token expires after 24 hours. Subsequent calls using the same
-- UniqueRequestToken made after the 24 hour limit could create duplicate
-- HITs.
createHIT_uniqueRequestToken :: Lens.Lens' CreateHIT (Prelude.Maybe Prelude.Text)
createHIT_uniqueRequestToken :: (Maybe Text -> f (Maybe Text)) -> CreateHIT -> f CreateHIT
createHIT_uniqueRequestToken = (CreateHIT -> Maybe Text)
-> (CreateHIT -> Maybe Text -> CreateHIT)
-> Lens CreateHIT CreateHIT (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHIT' {Maybe Text
uniqueRequestToken :: Maybe Text
$sel:uniqueRequestToken:CreateHIT' :: CreateHIT -> Maybe Text
uniqueRequestToken} -> Maybe Text
uniqueRequestToken) (\s :: CreateHIT
s@CreateHIT' {} Maybe Text
a -> CreateHIT
s {$sel:uniqueRequestToken:CreateHIT' :: Maybe Text
uniqueRequestToken = Maybe Text
a} :: CreateHIT)

-- | The number of seconds after an assignment for the HIT has been
-- submitted, after which the assignment is considered Approved
-- automatically unless the Requester explicitly rejects it.
createHIT_autoApprovalDelayInSeconds :: Lens.Lens' CreateHIT (Prelude.Maybe Prelude.Integer)
createHIT_autoApprovalDelayInSeconds :: (Maybe Integer -> f (Maybe Integer)) -> CreateHIT -> f CreateHIT
createHIT_autoApprovalDelayInSeconds = (CreateHIT -> Maybe Integer)
-> (CreateHIT -> Maybe Integer -> CreateHIT)
-> Lens CreateHIT CreateHIT (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHIT' {Maybe Integer
autoApprovalDelayInSeconds :: Maybe Integer
$sel:autoApprovalDelayInSeconds:CreateHIT' :: CreateHIT -> Maybe Integer
autoApprovalDelayInSeconds} -> Maybe Integer
autoApprovalDelayInSeconds) (\s :: CreateHIT
s@CreateHIT' {} Maybe Integer
a -> CreateHIT
s {$sel:autoApprovalDelayInSeconds:CreateHIT' :: Maybe Integer
autoApprovalDelayInSeconds = Maybe Integer
a} :: CreateHIT)

-- | An arbitrary data field. The RequesterAnnotation parameter lets your
-- application attach arbitrary data to the HIT for tracking purposes. For
-- example, this parameter could be an identifier internal to the
-- Requester\'s application that corresponds with the HIT.
--
-- The RequesterAnnotation parameter for a HIT is only visible to the
-- Requester who created the HIT. It is not shown to the Worker, or any
-- other Requester.
--
-- The RequesterAnnotation parameter may be different for each HIT you
-- submit. It does not affect how your HITs are grouped.
createHIT_requesterAnnotation :: Lens.Lens' CreateHIT (Prelude.Maybe Prelude.Text)
createHIT_requesterAnnotation :: (Maybe Text -> f (Maybe Text)) -> CreateHIT -> f CreateHIT
createHIT_requesterAnnotation = (CreateHIT -> Maybe Text)
-> (CreateHIT -> Maybe Text -> CreateHIT)
-> Lens CreateHIT CreateHIT (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHIT' {Maybe Text
requesterAnnotation :: Maybe Text
$sel:requesterAnnotation:CreateHIT' :: CreateHIT -> Maybe Text
requesterAnnotation} -> Maybe Text
requesterAnnotation) (\s :: CreateHIT
s@CreateHIT' {} Maybe Text
a -> CreateHIT
s {$sel:requesterAnnotation:CreateHIT' :: Maybe Text
requesterAnnotation = Maybe Text
a} :: CreateHIT)

-- | The number of times the HIT can be accepted and completed before the HIT
-- becomes unavailable.
createHIT_maxAssignments :: Lens.Lens' CreateHIT (Prelude.Maybe Prelude.Int)
createHIT_maxAssignments :: (Maybe Int -> f (Maybe Int)) -> CreateHIT -> f CreateHIT
createHIT_maxAssignments = (CreateHIT -> Maybe Int)
-> (CreateHIT -> Maybe Int -> CreateHIT)
-> Lens CreateHIT CreateHIT (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHIT' {Maybe Int
maxAssignments :: Maybe Int
$sel:maxAssignments:CreateHIT' :: CreateHIT -> Maybe Int
maxAssignments} -> Maybe Int
maxAssignments) (\s :: CreateHIT
s@CreateHIT' {} Maybe Int
a -> CreateHIT
s {$sel:maxAssignments:CreateHIT' :: Maybe Int
maxAssignments = Maybe Int
a} :: CreateHIT)

-- | One or more words or phrases that describe the HIT, separated by commas.
-- These words are used in searches to find HITs.
createHIT_keywords :: Lens.Lens' CreateHIT (Prelude.Maybe Prelude.Text)
createHIT_keywords :: (Maybe Text -> f (Maybe Text)) -> CreateHIT -> f CreateHIT
createHIT_keywords = (CreateHIT -> Maybe Text)
-> (CreateHIT -> Maybe Text -> CreateHIT)
-> Lens CreateHIT CreateHIT (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHIT' {Maybe Text
keywords :: Maybe Text
$sel:keywords:CreateHIT' :: CreateHIT -> Maybe Text
keywords} -> Maybe Text
keywords) (\s :: CreateHIT
s@CreateHIT' {} Maybe Text
a -> CreateHIT
s {$sel:keywords:CreateHIT' :: Maybe Text
keywords = Maybe Text
a} :: CreateHIT)

-- | The HITLayoutId allows you to use a pre-existing HIT design with
-- placeholder values and create an additional HIT by providing those
-- values as HITLayoutParameters.
--
-- Constraints: Either a Question parameter or a HITLayoutId parameter must
-- be provided.
createHIT_hITLayoutId :: Lens.Lens' CreateHIT (Prelude.Maybe Prelude.Text)
createHIT_hITLayoutId :: (Maybe Text -> f (Maybe Text)) -> CreateHIT -> f CreateHIT
createHIT_hITLayoutId = (CreateHIT -> Maybe Text)
-> (CreateHIT -> Maybe Text -> CreateHIT)
-> Lens CreateHIT CreateHIT (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHIT' {Maybe Text
hITLayoutId :: Maybe Text
$sel:hITLayoutId:CreateHIT' :: CreateHIT -> Maybe Text
hITLayoutId} -> Maybe Text
hITLayoutId) (\s :: CreateHIT
s@CreateHIT' {} Maybe Text
a -> CreateHIT
s {$sel:hITLayoutId:CreateHIT' :: Maybe Text
hITLayoutId = Maybe Text
a} :: CreateHIT)

-- | If the HITLayoutId is provided, any placeholder values must be filled in
-- with values using the HITLayoutParameter structure. For more
-- information, see HITLayout.
createHIT_hITLayoutParameters :: Lens.Lens' CreateHIT (Prelude.Maybe [HITLayoutParameter])
createHIT_hITLayoutParameters :: (Maybe [HITLayoutParameter] -> f (Maybe [HITLayoutParameter]))
-> CreateHIT -> f CreateHIT
createHIT_hITLayoutParameters = (CreateHIT -> Maybe [HITLayoutParameter])
-> (CreateHIT -> Maybe [HITLayoutParameter] -> CreateHIT)
-> Lens
     CreateHIT
     CreateHIT
     (Maybe [HITLayoutParameter])
     (Maybe [HITLayoutParameter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHIT' {Maybe [HITLayoutParameter]
hITLayoutParameters :: Maybe [HITLayoutParameter]
$sel:hITLayoutParameters:CreateHIT' :: CreateHIT -> Maybe [HITLayoutParameter]
hITLayoutParameters} -> Maybe [HITLayoutParameter]
hITLayoutParameters) (\s :: CreateHIT
s@CreateHIT' {} Maybe [HITLayoutParameter]
a -> CreateHIT
s {$sel:hITLayoutParameters:CreateHIT' :: Maybe [HITLayoutParameter]
hITLayoutParameters = Maybe [HITLayoutParameter]
a} :: CreateHIT) ((Maybe [HITLayoutParameter] -> f (Maybe [HITLayoutParameter]))
 -> CreateHIT -> f CreateHIT)
-> ((Maybe [HITLayoutParameter] -> f (Maybe [HITLayoutParameter]))
    -> Maybe [HITLayoutParameter] -> f (Maybe [HITLayoutParameter]))
-> (Maybe [HITLayoutParameter] -> f (Maybe [HITLayoutParameter]))
-> CreateHIT
-> f CreateHIT
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [HITLayoutParameter]
  [HITLayoutParameter]
  [HITLayoutParameter]
  [HITLayoutParameter]
-> Iso
     (Maybe [HITLayoutParameter])
     (Maybe [HITLayoutParameter])
     (Maybe [HITLayoutParameter])
     (Maybe [HITLayoutParameter])
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
  [HITLayoutParameter]
  [HITLayoutParameter]
  [HITLayoutParameter]
  [HITLayoutParameter]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Conditions that a Worker\'s Qualifications must meet in order to accept
-- the HIT. A HIT can have between zero and ten Qualification requirements.
-- All requirements must be met in order for a Worker to accept the HIT.
-- Additionally, other actions can be restricted using the @ActionsGuarded@
-- field on each @QualificationRequirement@ structure.
createHIT_qualificationRequirements :: Lens.Lens' CreateHIT (Prelude.Maybe [QualificationRequirement])
createHIT_qualificationRequirements :: (Maybe [QualificationRequirement]
 -> f (Maybe [QualificationRequirement]))
-> CreateHIT -> f CreateHIT
createHIT_qualificationRequirements = (CreateHIT -> Maybe [QualificationRequirement])
-> (CreateHIT -> Maybe [QualificationRequirement] -> CreateHIT)
-> Lens
     CreateHIT
     CreateHIT
     (Maybe [QualificationRequirement])
     (Maybe [QualificationRequirement])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHIT' {Maybe [QualificationRequirement]
qualificationRequirements :: Maybe [QualificationRequirement]
$sel:qualificationRequirements:CreateHIT' :: CreateHIT -> Maybe [QualificationRequirement]
qualificationRequirements} -> Maybe [QualificationRequirement]
qualificationRequirements) (\s :: CreateHIT
s@CreateHIT' {} Maybe [QualificationRequirement]
a -> CreateHIT
s {$sel:qualificationRequirements:CreateHIT' :: Maybe [QualificationRequirement]
qualificationRequirements = Maybe [QualificationRequirement]
a} :: CreateHIT) ((Maybe [QualificationRequirement]
  -> f (Maybe [QualificationRequirement]))
 -> CreateHIT -> f CreateHIT)
-> ((Maybe [QualificationRequirement]
     -> f (Maybe [QualificationRequirement]))
    -> Maybe [QualificationRequirement]
    -> f (Maybe [QualificationRequirement]))
-> (Maybe [QualificationRequirement]
    -> f (Maybe [QualificationRequirement]))
-> CreateHIT
-> f CreateHIT
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [QualificationRequirement]
  [QualificationRequirement]
  [QualificationRequirement]
  [QualificationRequirement]
-> Iso
     (Maybe [QualificationRequirement])
     (Maybe [QualificationRequirement])
     (Maybe [QualificationRequirement])
     (Maybe [QualificationRequirement])
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
  [QualificationRequirement]
  [QualificationRequirement]
  [QualificationRequirement]
  [QualificationRequirement]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The data the person completing the HIT uses to produce the results.
--
-- Constraints: Must be a QuestionForm data structure, an ExternalQuestion
-- data structure, or an HTMLQuestion data structure. The XML question data
-- must not be larger than 64 kilobytes (65,535 bytes) in size, including
-- whitespace.
--
-- Either a Question parameter or a HITLayoutId parameter must be provided.
createHIT_question :: Lens.Lens' CreateHIT (Prelude.Maybe Prelude.Text)
createHIT_question :: (Maybe Text -> f (Maybe Text)) -> CreateHIT -> f CreateHIT
createHIT_question = (CreateHIT -> Maybe Text)
-> (CreateHIT -> Maybe Text -> CreateHIT)
-> Lens CreateHIT CreateHIT (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHIT' {Maybe Text
question :: Maybe Text
$sel:question:CreateHIT' :: CreateHIT -> Maybe Text
question} -> Maybe Text
question) (\s :: CreateHIT
s@CreateHIT' {} Maybe Text
a -> CreateHIT
s {$sel:question:CreateHIT' :: Maybe Text
question = Maybe Text
a} :: CreateHIT)

-- | The Assignment-level Review Policy applies to the assignments under the
-- HIT. You can specify for Mechanical Turk to take various actions based
-- on the policy.
createHIT_assignmentReviewPolicy :: Lens.Lens' CreateHIT (Prelude.Maybe ReviewPolicy)
createHIT_assignmentReviewPolicy :: (Maybe ReviewPolicy -> f (Maybe ReviewPolicy))
-> CreateHIT -> f CreateHIT
createHIT_assignmentReviewPolicy = (CreateHIT -> Maybe ReviewPolicy)
-> (CreateHIT -> Maybe ReviewPolicy -> CreateHIT)
-> Lens
     CreateHIT CreateHIT (Maybe ReviewPolicy) (Maybe ReviewPolicy)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHIT' {Maybe ReviewPolicy
assignmentReviewPolicy :: Maybe ReviewPolicy
$sel:assignmentReviewPolicy:CreateHIT' :: CreateHIT -> Maybe ReviewPolicy
assignmentReviewPolicy} -> Maybe ReviewPolicy
assignmentReviewPolicy) (\s :: CreateHIT
s@CreateHIT' {} Maybe ReviewPolicy
a -> CreateHIT
s {$sel:assignmentReviewPolicy:CreateHIT' :: Maybe ReviewPolicy
assignmentReviewPolicy = Maybe ReviewPolicy
a} :: CreateHIT)

-- | An amount of time, in seconds, after which the HIT is no longer
-- available for users to accept. After the lifetime of the HIT elapses,
-- the HIT no longer appears in HIT searches, even if not all of the
-- assignments for the HIT have been accepted.
createHIT_lifetimeInSeconds :: Lens.Lens' CreateHIT Prelude.Integer
createHIT_lifetimeInSeconds :: (Integer -> f Integer) -> CreateHIT -> f CreateHIT
createHIT_lifetimeInSeconds = (CreateHIT -> Integer)
-> (CreateHIT -> Integer -> CreateHIT)
-> Lens CreateHIT CreateHIT Integer Integer
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHIT' {Integer
lifetimeInSeconds :: Integer
$sel:lifetimeInSeconds:CreateHIT' :: CreateHIT -> Integer
lifetimeInSeconds} -> Integer
lifetimeInSeconds) (\s :: CreateHIT
s@CreateHIT' {} Integer
a -> CreateHIT
s {$sel:lifetimeInSeconds:CreateHIT' :: Integer
lifetimeInSeconds = Integer
a} :: CreateHIT)

-- | The amount of time, in seconds, that a Worker has to complete the HIT
-- after accepting it. If a Worker does not complete the assignment within
-- the specified duration, the assignment is considered abandoned. If the
-- HIT is still active (that is, its lifetime has not elapsed), the
-- assignment becomes available for other users to find and accept.
createHIT_assignmentDurationInSeconds :: Lens.Lens' CreateHIT Prelude.Integer
createHIT_assignmentDurationInSeconds :: (Integer -> f Integer) -> CreateHIT -> f CreateHIT
createHIT_assignmentDurationInSeconds = (CreateHIT -> Integer)
-> (CreateHIT -> Integer -> CreateHIT)
-> Lens CreateHIT CreateHIT Integer Integer
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHIT' {Integer
assignmentDurationInSeconds :: Integer
$sel:assignmentDurationInSeconds:CreateHIT' :: CreateHIT -> Integer
assignmentDurationInSeconds} -> Integer
assignmentDurationInSeconds) (\s :: CreateHIT
s@CreateHIT' {} Integer
a -> CreateHIT
s {$sel:assignmentDurationInSeconds:CreateHIT' :: Integer
assignmentDurationInSeconds = Integer
a} :: CreateHIT)

-- | The amount of money the Requester will pay a Worker for successfully
-- completing the HIT.
createHIT_reward :: Lens.Lens' CreateHIT Prelude.Text
createHIT_reward :: (Text -> f Text) -> CreateHIT -> f CreateHIT
createHIT_reward = (CreateHIT -> Text)
-> (CreateHIT -> Text -> CreateHIT)
-> Lens CreateHIT CreateHIT Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHIT' {Text
reward :: Text
$sel:reward:CreateHIT' :: CreateHIT -> Text
reward} -> Text
reward) (\s :: CreateHIT
s@CreateHIT' {} Text
a -> CreateHIT
s {$sel:reward:CreateHIT' :: Text
reward = Text
a} :: CreateHIT)

-- | The title of the HIT. A title should be short and descriptive about the
-- kind of task the HIT contains. On the Amazon Mechanical Turk web site,
-- the HIT title appears in search results, and everywhere the HIT is
-- mentioned.
createHIT_title :: Lens.Lens' CreateHIT Prelude.Text
createHIT_title :: (Text -> f Text) -> CreateHIT -> f CreateHIT
createHIT_title = (CreateHIT -> Text)
-> (CreateHIT -> Text -> CreateHIT)
-> Lens CreateHIT CreateHIT Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHIT' {Text
title :: Text
$sel:title:CreateHIT' :: CreateHIT -> Text
title} -> Text
title) (\s :: CreateHIT
s@CreateHIT' {} Text
a -> CreateHIT
s {$sel:title:CreateHIT' :: Text
title = Text
a} :: CreateHIT)

-- | A general description of the HIT. A description includes detailed
-- information about the kind of task the HIT contains. On the Amazon
-- Mechanical Turk web site, the HIT description appears in the expanded
-- view of search results, and in the HIT and assignment screens. A good
-- description gives the user enough information to evaluate the HIT before
-- accepting it.
createHIT_description :: Lens.Lens' CreateHIT Prelude.Text
createHIT_description :: (Text -> f Text) -> CreateHIT -> f CreateHIT
createHIT_description = (CreateHIT -> Text)
-> (CreateHIT -> Text -> CreateHIT)
-> Lens CreateHIT CreateHIT Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHIT' {Text
description :: Text
$sel:description:CreateHIT' :: CreateHIT -> Text
description} -> Text
description) (\s :: CreateHIT
s@CreateHIT' {} Text
a -> CreateHIT
s {$sel:description:CreateHIT' :: Text
description = Text
a} :: CreateHIT)

instance Core.AWSRequest CreateHIT where
  type AWSResponse CreateHIT = CreateHITResponse
  request :: CreateHIT -> Request CreateHIT
request = Service -> CreateHIT -> Request CreateHIT
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateHIT
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateHIT)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateHIT))
-> Logger
-> Service
-> Proxy CreateHIT
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateHIT)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe HIT -> Int -> CreateHITResponse
CreateHITResponse'
            (Maybe HIT -> Int -> CreateHITResponse)
-> Either String (Maybe HIT)
-> Either String (Int -> CreateHITResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe HIT)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"HIT")
            Either String (Int -> CreateHITResponse)
-> Either String Int -> Either String CreateHITResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable CreateHIT

instance Prelude.NFData CreateHIT

instance Core.ToHeaders CreateHIT where
  toHeaders :: CreateHIT -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateHIT -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"MTurkRequesterServiceV20170117.CreateHIT" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON CreateHIT where
  toJSON :: CreateHIT -> Value
toJSON CreateHIT' {Integer
Maybe Int
Maybe Integer
Maybe [HITLayoutParameter]
Maybe [QualificationRequirement]
Maybe Text
Maybe ReviewPolicy
Text
description :: Text
title :: Text
reward :: Text
assignmentDurationInSeconds :: Integer
lifetimeInSeconds :: Integer
assignmentReviewPolicy :: Maybe ReviewPolicy
question :: Maybe Text
qualificationRequirements :: Maybe [QualificationRequirement]
hITLayoutParameters :: Maybe [HITLayoutParameter]
hITLayoutId :: Maybe Text
keywords :: Maybe Text
maxAssignments :: Maybe Int
requesterAnnotation :: Maybe Text
autoApprovalDelayInSeconds :: Maybe Integer
uniqueRequestToken :: Maybe Text
hITReviewPolicy :: Maybe ReviewPolicy
$sel:description:CreateHIT' :: CreateHIT -> Text
$sel:title:CreateHIT' :: CreateHIT -> Text
$sel:reward:CreateHIT' :: CreateHIT -> Text
$sel:assignmentDurationInSeconds:CreateHIT' :: CreateHIT -> Integer
$sel:lifetimeInSeconds:CreateHIT' :: CreateHIT -> Integer
$sel:assignmentReviewPolicy:CreateHIT' :: CreateHIT -> Maybe ReviewPolicy
$sel:question:CreateHIT' :: CreateHIT -> Maybe Text
$sel:qualificationRequirements:CreateHIT' :: CreateHIT -> Maybe [QualificationRequirement]
$sel:hITLayoutParameters:CreateHIT' :: CreateHIT -> Maybe [HITLayoutParameter]
$sel:hITLayoutId:CreateHIT' :: CreateHIT -> Maybe Text
$sel:keywords:CreateHIT' :: CreateHIT -> Maybe Text
$sel:maxAssignments:CreateHIT' :: CreateHIT -> Maybe Int
$sel:requesterAnnotation:CreateHIT' :: CreateHIT -> Maybe Text
$sel:autoApprovalDelayInSeconds:CreateHIT' :: CreateHIT -> Maybe Integer
$sel:uniqueRequestToken:CreateHIT' :: CreateHIT -> Maybe Text
$sel:hITReviewPolicy:CreateHIT' :: CreateHIT -> Maybe ReviewPolicy
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"HITReviewPolicy" Text -> ReviewPolicy -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ReviewPolicy -> Pair) -> Maybe ReviewPolicy -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ReviewPolicy
hITReviewPolicy,
            (Text
"UniqueRequestToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
uniqueRequestToken,
            (Text
"AutoApprovalDelayInSeconds" Text -> Integer -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Integer -> Pair) -> Maybe Integer -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Integer
autoApprovalDelayInSeconds,
            (Text
"RequesterAnnotation" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
requesterAnnotation,
            (Text
"MaxAssignments" 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
maxAssignments,
            (Text
"Keywords" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
keywords,
            (Text
"HITLayoutId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
hITLayoutId,
            (Text
"HITLayoutParameters" Text -> [HITLayoutParameter] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([HITLayoutParameter] -> Pair)
-> Maybe [HITLayoutParameter] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [HITLayoutParameter]
hITLayoutParameters,
            (Text
"QualificationRequirements" Text -> [QualificationRequirement] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([QualificationRequirement] -> Pair)
-> Maybe [QualificationRequirement] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [QualificationRequirement]
qualificationRequirements,
            (Text
"Question" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
question,
            (Text
"AssignmentReviewPolicy" Text -> ReviewPolicy -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ReviewPolicy -> Pair) -> Maybe ReviewPolicy -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ReviewPolicy
assignmentReviewPolicy,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"LifetimeInSeconds" Text -> Integer -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Integer
lifetimeInSeconds),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"AssignmentDurationInSeconds"
                  Text -> Integer -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Integer
assignmentDurationInSeconds
              ),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Reward" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
reward),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Title" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
title),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Description" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
description)
          ]
      )

instance Core.ToPath CreateHIT where
  toPath :: CreateHIT -> ByteString
toPath = ByteString -> CreateHIT -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery CreateHIT where
  toQuery :: CreateHIT -> QueryString
toQuery = QueryString -> CreateHIT -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newCreateHITResponse' smart constructor.
data CreateHITResponse = CreateHITResponse'
  { -- | Contains the newly created HIT data. For a description of the HIT data
    -- structure as it appears in responses, see the HIT Data Structure
    -- documentation.
    CreateHITResponse -> Maybe HIT
hit :: Prelude.Maybe HIT,
    -- | The response's http status code.
    CreateHITResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateHITResponse -> CreateHITResponse -> Bool
(CreateHITResponse -> CreateHITResponse -> Bool)
-> (CreateHITResponse -> CreateHITResponse -> Bool)
-> Eq CreateHITResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateHITResponse -> CreateHITResponse -> Bool
$c/= :: CreateHITResponse -> CreateHITResponse -> Bool
== :: CreateHITResponse -> CreateHITResponse -> Bool
$c== :: CreateHITResponse -> CreateHITResponse -> Bool
Prelude.Eq, ReadPrec [CreateHITResponse]
ReadPrec CreateHITResponse
Int -> ReadS CreateHITResponse
ReadS [CreateHITResponse]
(Int -> ReadS CreateHITResponse)
-> ReadS [CreateHITResponse]
-> ReadPrec CreateHITResponse
-> ReadPrec [CreateHITResponse]
-> Read CreateHITResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateHITResponse]
$creadListPrec :: ReadPrec [CreateHITResponse]
readPrec :: ReadPrec CreateHITResponse
$creadPrec :: ReadPrec CreateHITResponse
readList :: ReadS [CreateHITResponse]
$creadList :: ReadS [CreateHITResponse]
readsPrec :: Int -> ReadS CreateHITResponse
$creadsPrec :: Int -> ReadS CreateHITResponse
Prelude.Read, Int -> CreateHITResponse -> ShowS
[CreateHITResponse] -> ShowS
CreateHITResponse -> String
(Int -> CreateHITResponse -> ShowS)
-> (CreateHITResponse -> String)
-> ([CreateHITResponse] -> ShowS)
-> Show CreateHITResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateHITResponse] -> ShowS
$cshowList :: [CreateHITResponse] -> ShowS
show :: CreateHITResponse -> String
$cshow :: CreateHITResponse -> String
showsPrec :: Int -> CreateHITResponse -> ShowS
$cshowsPrec :: Int -> CreateHITResponse -> ShowS
Prelude.Show, (forall x. CreateHITResponse -> Rep CreateHITResponse x)
-> (forall x. Rep CreateHITResponse x -> CreateHITResponse)
-> Generic CreateHITResponse
forall x. Rep CreateHITResponse x -> CreateHITResponse
forall x. CreateHITResponse -> Rep CreateHITResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateHITResponse x -> CreateHITResponse
$cfrom :: forall x. CreateHITResponse -> Rep CreateHITResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateHITResponse' 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:
--
-- 'hit', 'createHITResponse_hit' - Contains the newly created HIT data. For a description of the HIT data
-- structure as it appears in responses, see the HIT Data Structure
-- documentation.
--
-- 'httpStatus', 'createHITResponse_httpStatus' - The response's http status code.
newCreateHITResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateHITResponse
newCreateHITResponse :: Int -> CreateHITResponse
newCreateHITResponse Int
pHttpStatus_ =
  CreateHITResponse' :: Maybe HIT -> Int -> CreateHITResponse
CreateHITResponse'
    { $sel:hit:CreateHITResponse' :: Maybe HIT
hit = Maybe HIT
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateHITResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Contains the newly created HIT data. For a description of the HIT data
-- structure as it appears in responses, see the HIT Data Structure
-- documentation.
createHITResponse_hit :: Lens.Lens' CreateHITResponse (Prelude.Maybe HIT)
createHITResponse_hit :: (Maybe HIT -> f (Maybe HIT))
-> CreateHITResponse -> f CreateHITResponse
createHITResponse_hit = (CreateHITResponse -> Maybe HIT)
-> (CreateHITResponse -> Maybe HIT -> CreateHITResponse)
-> Lens CreateHITResponse CreateHITResponse (Maybe HIT) (Maybe HIT)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHITResponse' {Maybe HIT
hit :: Maybe HIT
$sel:hit:CreateHITResponse' :: CreateHITResponse -> Maybe HIT
hit} -> Maybe HIT
hit) (\s :: CreateHITResponse
s@CreateHITResponse' {} Maybe HIT
a -> CreateHITResponse
s {$sel:hit:CreateHITResponse' :: Maybe HIT
hit = Maybe HIT
a} :: CreateHITResponse)

-- | The response's http status code.
createHITResponse_httpStatus :: Lens.Lens' CreateHITResponse Prelude.Int
createHITResponse_httpStatus :: (Int -> f Int) -> CreateHITResponse -> f CreateHITResponse
createHITResponse_httpStatus = (CreateHITResponse -> Int)
-> (CreateHITResponse -> Int -> CreateHITResponse)
-> Lens CreateHITResponse CreateHITResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHITResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateHITResponse' :: CreateHITResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateHITResponse
s@CreateHITResponse' {} Int
a -> CreateHITResponse
s {$sel:httpStatus:CreateHITResponse' :: Int
httpStatus = Int
a} :: CreateHITResponse)

instance Prelude.NFData CreateHITResponse