{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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_assignmentReviewPolicy,
    createHIT_autoApprovalDelayInSeconds,
    createHIT_hITLayoutId,
    createHIT_hITLayoutParameters,
    createHIT_hITReviewPolicy,
    createHIT_keywords,
    createHIT_maxAssignments,
    createHIT_qualificationRequirements,
    createHIT_question,
    createHIT_requesterAnnotation,
    createHIT_uniqueRequestToken,
    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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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 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,
    -- | 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,
    -- | 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],
    -- | 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,
    -- | 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 number of times the HIT can be accepted and completed before the HIT
    -- becomes unavailable.
    CreateHIT -> Maybe Int
maxAssignments :: Prelude.Maybe Prelude.Int,
    -- | 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,
    -- | 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,
    -- | 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,
    -- | 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
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]
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
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. 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:
--
-- '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.
--
-- '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.
--
-- '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.
--
-- '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.
--
-- '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.
--
-- 'maxAssignments', 'createHIT_maxAssignments' - The number of times the HIT can be accepted and completed before the HIT
-- becomes unavailable.
--
-- '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.
--
-- '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.
--
-- '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.
--
-- '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'
      { $sel:assignmentReviewPolicy:CreateHIT' :: Maybe ReviewPolicy
assignmentReviewPolicy =
          forall a. Maybe a
Prelude.Nothing,
        $sel:autoApprovalDelayInSeconds:CreateHIT' :: Maybe Integer
autoApprovalDelayInSeconds = forall a. Maybe a
Prelude.Nothing,
        $sel:hITLayoutId:CreateHIT' :: Maybe Text
hITLayoutId = forall a. Maybe a
Prelude.Nothing,
        $sel:hITLayoutParameters:CreateHIT' :: Maybe [HITLayoutParameter]
hITLayoutParameters = forall a. Maybe a
Prelude.Nothing,
        $sel:hITReviewPolicy:CreateHIT' :: Maybe ReviewPolicy
hITReviewPolicy = forall a. Maybe a
Prelude.Nothing,
        $sel:keywords:CreateHIT' :: Maybe Text
keywords = forall a. Maybe a
Prelude.Nothing,
        $sel:maxAssignments:CreateHIT' :: Maybe Int
maxAssignments = forall a. Maybe a
Prelude.Nothing,
        $sel:qualificationRequirements:CreateHIT' :: Maybe [QualificationRequirement]
qualificationRequirements = forall a. Maybe a
Prelude.Nothing,
        $sel:question:CreateHIT' :: Maybe Text
question = forall a. Maybe a
Prelude.Nothing,
        $sel:requesterAnnotation:CreateHIT' :: Maybe Text
requesterAnnotation = forall a. Maybe a
Prelude.Nothing,
        $sel:uniqueRequestToken:CreateHIT' :: Maybe Text
uniqueRequestToken = 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 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 :: Lens' CreateHIT (Maybe ReviewPolicy)
createHIT_assignmentReviewPolicy = 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)

-- | 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 :: Lens' CreateHIT (Maybe Integer)
createHIT_autoApprovalDelayInSeconds = 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)

-- | 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 :: Lens' CreateHIT (Maybe Text)
createHIT_hITLayoutId = 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 :: Lens' CreateHIT (Maybe [HITLayoutParameter])
createHIT_hITLayoutParameters = 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) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | 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 :: Lens' CreateHIT (Maybe ReviewPolicy)
createHIT_hITReviewPolicy = 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)

-- | 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 :: Lens' CreateHIT (Maybe Text)
createHIT_keywords = 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 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 :: Lens' CreateHIT (Maybe Int)
createHIT_maxAssignments = 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)

-- | 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 :: Lens' CreateHIT (Maybe [QualificationRequirement])
createHIT_qualificationRequirements = 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) 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 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 :: Lens' CreateHIT (Maybe Text)
createHIT_question = 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)

-- | 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 :: Lens' CreateHIT (Maybe Text)
createHIT_requesterAnnotation = 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)

-- | 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 :: Lens' CreateHIT (Maybe Text)
createHIT_uniqueRequestToken = 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)

-- | 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 :: Lens' CreateHIT Integer
createHIT_lifetimeInSeconds = 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 :: Lens' CreateHIT Integer
createHIT_assignmentDurationInSeconds = 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 :: Lens' CreateHIT Text
createHIT_reward = 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 :: Lens' CreateHIT Text
createHIT_title = 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 :: Lens' CreateHIT Text
createHIT_description = 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 :: (Service -> Service) -> CreateHIT -> Request CreateHIT
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateHIT
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateHIT)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe HIT -> Int -> CreateHITResponse
CreateHITResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"HIT")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable CreateHIT where
  hashWithSalt :: Int -> CreateHIT -> Int
hashWithSalt Int
_salt 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
uniqueRequestToken :: Maybe Text
requesterAnnotation :: Maybe Text
question :: Maybe Text
qualificationRequirements :: Maybe [QualificationRequirement]
maxAssignments :: Maybe Int
keywords :: Maybe Text
hITReviewPolicy :: Maybe ReviewPolicy
hITLayoutParameters :: Maybe [HITLayoutParameter]
hITLayoutId :: Maybe Text
autoApprovalDelayInSeconds :: Maybe Integer
assignmentReviewPolicy :: 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:uniqueRequestToken:CreateHIT' :: CreateHIT -> Maybe Text
$sel:requesterAnnotation:CreateHIT' :: CreateHIT -> Maybe Text
$sel:question:CreateHIT' :: CreateHIT -> Maybe Text
$sel:qualificationRequirements:CreateHIT' :: CreateHIT -> Maybe [QualificationRequirement]
$sel:maxAssignments:CreateHIT' :: CreateHIT -> Maybe Int
$sel:keywords:CreateHIT' :: CreateHIT -> Maybe Text
$sel:hITReviewPolicy:CreateHIT' :: CreateHIT -> Maybe ReviewPolicy
$sel:hITLayoutParameters:CreateHIT' :: CreateHIT -> Maybe [HITLayoutParameter]
$sel:hITLayoutId:CreateHIT' :: CreateHIT -> Maybe Text
$sel:autoApprovalDelayInSeconds:CreateHIT' :: CreateHIT -> Maybe Integer
$sel:assignmentReviewPolicy:CreateHIT' :: CreateHIT -> Maybe ReviewPolicy
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ReviewPolicy
assignmentReviewPolicy
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
autoApprovalDelayInSeconds
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
hITLayoutId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [HITLayoutParameter]
hITLayoutParameters
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ReviewPolicy
hITReviewPolicy
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
keywords
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
maxAssignments
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [QualificationRequirement]
qualificationRequirements
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
question
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
requesterAnnotation
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
uniqueRequestToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Integer
lifetimeInSeconds
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Integer
assignmentDurationInSeconds
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
reward
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
title
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
description

instance Prelude.NFData CreateHIT where
  rnf :: CreateHIT -> ()
rnf 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
uniqueRequestToken :: Maybe Text
requesterAnnotation :: Maybe Text
question :: Maybe Text
qualificationRequirements :: Maybe [QualificationRequirement]
maxAssignments :: Maybe Int
keywords :: Maybe Text
hITReviewPolicy :: Maybe ReviewPolicy
hITLayoutParameters :: Maybe [HITLayoutParameter]
hITLayoutId :: Maybe Text
autoApprovalDelayInSeconds :: Maybe Integer
assignmentReviewPolicy :: 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:uniqueRequestToken:CreateHIT' :: CreateHIT -> Maybe Text
$sel:requesterAnnotation:CreateHIT' :: CreateHIT -> Maybe Text
$sel:question:CreateHIT' :: CreateHIT -> Maybe Text
$sel:qualificationRequirements:CreateHIT' :: CreateHIT -> Maybe [QualificationRequirement]
$sel:maxAssignments:CreateHIT' :: CreateHIT -> Maybe Int
$sel:keywords:CreateHIT' :: CreateHIT -> Maybe Text
$sel:hITReviewPolicy:CreateHIT' :: CreateHIT -> Maybe ReviewPolicy
$sel:hITLayoutParameters:CreateHIT' :: CreateHIT -> Maybe [HITLayoutParameter]
$sel:hITLayoutId:CreateHIT' :: CreateHIT -> Maybe Text
$sel:autoApprovalDelayInSeconds:CreateHIT' :: CreateHIT -> Maybe Integer
$sel:assignmentReviewPolicy:CreateHIT' :: CreateHIT -> Maybe ReviewPolicy
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ReviewPolicy
assignmentReviewPolicy
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
autoApprovalDelayInSeconds
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
hITLayoutId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [HITLayoutParameter]
hITLayoutParameters
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ReviewPolicy
hITReviewPolicy
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
keywords
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
maxAssignments
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [QualificationRequirement]
qualificationRequirements
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
question
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
requesterAnnotation
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
uniqueRequestToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Integer
lifetimeInSeconds
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Integer
assignmentDurationInSeconds
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
reward
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
title
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
description

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

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

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

instance Data.ToQuery CreateHIT where
  toQuery :: CreateHIT -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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]
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
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. 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'
    { $sel:hit:CreateHITResponse' :: Maybe HIT
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 :: Lens' CreateHITResponse (Maybe HIT)
createHITResponse_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 :: Lens' CreateHITResponse Int
createHITResponse_httpStatus = 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 where
  rnf :: CreateHITResponse -> ()
rnf CreateHITResponse' {Int
Maybe HIT
httpStatus :: Int
hit :: Maybe HIT
$sel:httpStatus:CreateHITResponse' :: CreateHITResponse -> Int
$sel:hit:CreateHITResponse' :: CreateHITResponse -> Maybe HIT
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe HIT
hit
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus