{-# 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.CreateHITWithHITType
-- 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 @CreateHITWithHITType@ operation creates a new Human Intelligence
-- Task (HIT) using an existing HITTypeID generated by the @CreateHITType@
-- operation.
--
-- This is an alternative way to create HITs from the @CreateHIT@
-- operation. This is the recommended best practice for Requesters who are
-- creating large numbers of HITs.
--
-- CreateHITWithHITType 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.CreateHITWithHITType
  ( -- * Creating a Request
    CreateHITWithHITType (..),
    newCreateHITWithHITType,

    -- * Request Lenses
    createHITWithHITType_assignmentReviewPolicy,
    createHITWithHITType_hITLayoutId,
    createHITWithHITType_hITLayoutParameters,
    createHITWithHITType_hITReviewPolicy,
    createHITWithHITType_maxAssignments,
    createHITWithHITType_question,
    createHITWithHITType_requesterAnnotation,
    createHITWithHITType_uniqueRequestToken,
    createHITWithHITType_hITTypeId,
    createHITWithHITType_lifetimeInSeconds,

    -- * Destructuring the Response
    CreateHITWithHITTypeResponse (..),
    newCreateHITWithHITTypeResponse,

    -- * Response Lenses
    createHITWithHITTypeResponse_hit,
    createHITWithHITTypeResponse_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:/ 'newCreateHITWithHITType' smart constructor.
data CreateHITWithHITType = CreateHITWithHITType'
  { -- | 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.
    CreateHITWithHITType -> Maybe ReviewPolicy
assignmentReviewPolicy :: Prelude.Maybe ReviewPolicy,
    -- | 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.
    CreateHITWithHITType -> 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.
    CreateHITWithHITType -> 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.
    CreateHITWithHITType -> Maybe ReviewPolicy
hITReviewPolicy :: Prelude.Maybe ReviewPolicy,
    -- | The number of times the HIT can be accepted and completed before the HIT
    -- becomes unavailable.
    CreateHITWithHITType -> Maybe Int
maxAssignments :: Prelude.Maybe Prelude.Int,
    -- | 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.
    CreateHITWithHITType -> 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.
    CreateHITWithHITType -> 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.
    CreateHITWithHITType -> Maybe Text
uniqueRequestToken :: Prelude.Maybe Prelude.Text,
    -- | The HIT type ID you want to create this HIT with.
    CreateHITWithHITType -> Text
hITTypeId :: 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.
    CreateHITWithHITType -> Integer
lifetimeInSeconds :: Prelude.Integer
  }
  deriving (CreateHITWithHITType -> CreateHITWithHITType -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateHITWithHITType -> CreateHITWithHITType -> Bool
$c/= :: CreateHITWithHITType -> CreateHITWithHITType -> Bool
== :: CreateHITWithHITType -> CreateHITWithHITType -> Bool
$c== :: CreateHITWithHITType -> CreateHITWithHITType -> Bool
Prelude.Eq, ReadPrec [CreateHITWithHITType]
ReadPrec CreateHITWithHITType
Int -> ReadS CreateHITWithHITType
ReadS [CreateHITWithHITType]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateHITWithHITType]
$creadListPrec :: ReadPrec [CreateHITWithHITType]
readPrec :: ReadPrec CreateHITWithHITType
$creadPrec :: ReadPrec CreateHITWithHITType
readList :: ReadS [CreateHITWithHITType]
$creadList :: ReadS [CreateHITWithHITType]
readsPrec :: Int -> ReadS CreateHITWithHITType
$creadsPrec :: Int -> ReadS CreateHITWithHITType
Prelude.Read, Int -> CreateHITWithHITType -> ShowS
[CreateHITWithHITType] -> ShowS
CreateHITWithHITType -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateHITWithHITType] -> ShowS
$cshowList :: [CreateHITWithHITType] -> ShowS
show :: CreateHITWithHITType -> String
$cshow :: CreateHITWithHITType -> String
showsPrec :: Int -> CreateHITWithHITType -> ShowS
$cshowsPrec :: Int -> CreateHITWithHITType -> ShowS
Prelude.Show, forall x. Rep CreateHITWithHITType x -> CreateHITWithHITType
forall x. CreateHITWithHITType -> Rep CreateHITWithHITType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateHITWithHITType x -> CreateHITWithHITType
$cfrom :: forall x. CreateHITWithHITType -> Rep CreateHITWithHITType x
Prelude.Generic)

-- |
-- Create a value of 'CreateHITWithHITType' 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', 'createHITWithHITType_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.
--
-- 'hITLayoutId', 'createHITWithHITType_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', 'createHITWithHITType_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', 'createHITWithHITType_hITReviewPolicy' - The HIT-level Review Policy applies to the HIT. You can specify for
-- Mechanical Turk to take various actions based on the policy.
--
-- 'maxAssignments', 'createHITWithHITType_maxAssignments' - The number of times the HIT can be accepted and completed before the HIT
-- becomes unavailable.
--
-- 'question', 'createHITWithHITType_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', 'createHITWithHITType_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', 'createHITWithHITType_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.
--
-- 'hITTypeId', 'createHITWithHITType_hITTypeId' - The HIT type ID you want to create this HIT with.
--
-- 'lifetimeInSeconds', 'createHITWithHITType_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.
newCreateHITWithHITType ::
  -- | 'hITTypeId'
  Prelude.Text ->
  -- | 'lifetimeInSeconds'
  Prelude.Integer ->
  CreateHITWithHITType
newCreateHITWithHITType :: Text -> Integer -> CreateHITWithHITType
newCreateHITWithHITType
  Text
pHITTypeId_
  Integer
pLifetimeInSeconds_ =
    CreateHITWithHITType'
      { $sel:assignmentReviewPolicy:CreateHITWithHITType' :: Maybe ReviewPolicy
assignmentReviewPolicy =
          forall a. Maybe a
Prelude.Nothing,
        $sel:hITLayoutId:CreateHITWithHITType' :: Maybe Text
hITLayoutId = forall a. Maybe a
Prelude.Nothing,
        $sel:hITLayoutParameters:CreateHITWithHITType' :: Maybe [HITLayoutParameter]
hITLayoutParameters = forall a. Maybe a
Prelude.Nothing,
        $sel:hITReviewPolicy:CreateHITWithHITType' :: Maybe ReviewPolicy
hITReviewPolicy = forall a. Maybe a
Prelude.Nothing,
        $sel:maxAssignments:CreateHITWithHITType' :: Maybe Int
maxAssignments = forall a. Maybe a
Prelude.Nothing,
        $sel:question:CreateHITWithHITType' :: Maybe Text
question = forall a. Maybe a
Prelude.Nothing,
        $sel:requesterAnnotation:CreateHITWithHITType' :: Maybe Text
requesterAnnotation = forall a. Maybe a
Prelude.Nothing,
        $sel:uniqueRequestToken:CreateHITWithHITType' :: Maybe Text
uniqueRequestToken = forall a. Maybe a
Prelude.Nothing,
        $sel:hITTypeId:CreateHITWithHITType' :: Text
hITTypeId = Text
pHITTypeId_,
        $sel:lifetimeInSeconds:CreateHITWithHITType' :: Integer
lifetimeInSeconds = Integer
pLifetimeInSeconds_
      }

-- | 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.
createHITWithHITType_assignmentReviewPolicy :: Lens.Lens' CreateHITWithHITType (Prelude.Maybe ReviewPolicy)
createHITWithHITType_assignmentReviewPolicy :: Lens' CreateHITWithHITType (Maybe ReviewPolicy)
createHITWithHITType_assignmentReviewPolicy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHITWithHITType' {Maybe ReviewPolicy
assignmentReviewPolicy :: Maybe ReviewPolicy
$sel:assignmentReviewPolicy:CreateHITWithHITType' :: CreateHITWithHITType -> Maybe ReviewPolicy
assignmentReviewPolicy} -> Maybe ReviewPolicy
assignmentReviewPolicy) (\s :: CreateHITWithHITType
s@CreateHITWithHITType' {} Maybe ReviewPolicy
a -> CreateHITWithHITType
s {$sel:assignmentReviewPolicy:CreateHITWithHITType' :: Maybe ReviewPolicy
assignmentReviewPolicy = Maybe ReviewPolicy
a} :: CreateHITWithHITType)

-- | 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.
createHITWithHITType_hITLayoutId :: Lens.Lens' CreateHITWithHITType (Prelude.Maybe Prelude.Text)
createHITWithHITType_hITLayoutId :: Lens' CreateHITWithHITType (Maybe Text)
createHITWithHITType_hITLayoutId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHITWithHITType' {Maybe Text
hITLayoutId :: Maybe Text
$sel:hITLayoutId:CreateHITWithHITType' :: CreateHITWithHITType -> Maybe Text
hITLayoutId} -> Maybe Text
hITLayoutId) (\s :: CreateHITWithHITType
s@CreateHITWithHITType' {} Maybe Text
a -> CreateHITWithHITType
s {$sel:hITLayoutId:CreateHITWithHITType' :: Maybe Text
hITLayoutId = Maybe Text
a} :: CreateHITWithHITType)

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

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

-- | 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.
createHITWithHITType_question :: Lens.Lens' CreateHITWithHITType (Prelude.Maybe Prelude.Text)
createHITWithHITType_question :: Lens' CreateHITWithHITType (Maybe Text)
createHITWithHITType_question = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHITWithHITType' {Maybe Text
question :: Maybe Text
$sel:question:CreateHITWithHITType' :: CreateHITWithHITType -> Maybe Text
question} -> Maybe Text
question) (\s :: CreateHITWithHITType
s@CreateHITWithHITType' {} Maybe Text
a -> CreateHITWithHITType
s {$sel:question:CreateHITWithHITType' :: Maybe Text
question = Maybe Text
a} :: CreateHITWithHITType)

-- | 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.
createHITWithHITType_requesterAnnotation :: Lens.Lens' CreateHITWithHITType (Prelude.Maybe Prelude.Text)
createHITWithHITType_requesterAnnotation :: Lens' CreateHITWithHITType (Maybe Text)
createHITWithHITType_requesterAnnotation = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHITWithHITType' {Maybe Text
requesterAnnotation :: Maybe Text
$sel:requesterAnnotation:CreateHITWithHITType' :: CreateHITWithHITType -> Maybe Text
requesterAnnotation} -> Maybe Text
requesterAnnotation) (\s :: CreateHITWithHITType
s@CreateHITWithHITType' {} Maybe Text
a -> CreateHITWithHITType
s {$sel:requesterAnnotation:CreateHITWithHITType' :: Maybe Text
requesterAnnotation = Maybe Text
a} :: CreateHITWithHITType)

-- | 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.
createHITWithHITType_uniqueRequestToken :: Lens.Lens' CreateHITWithHITType (Prelude.Maybe Prelude.Text)
createHITWithHITType_uniqueRequestToken :: Lens' CreateHITWithHITType (Maybe Text)
createHITWithHITType_uniqueRequestToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHITWithHITType' {Maybe Text
uniqueRequestToken :: Maybe Text
$sel:uniqueRequestToken:CreateHITWithHITType' :: CreateHITWithHITType -> Maybe Text
uniqueRequestToken} -> Maybe Text
uniqueRequestToken) (\s :: CreateHITWithHITType
s@CreateHITWithHITType' {} Maybe Text
a -> CreateHITWithHITType
s {$sel:uniqueRequestToken:CreateHITWithHITType' :: Maybe Text
uniqueRequestToken = Maybe Text
a} :: CreateHITWithHITType)

-- | The HIT type ID you want to create this HIT with.
createHITWithHITType_hITTypeId :: Lens.Lens' CreateHITWithHITType Prelude.Text
createHITWithHITType_hITTypeId :: Lens' CreateHITWithHITType Text
createHITWithHITType_hITTypeId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHITWithHITType' {Text
hITTypeId :: Text
$sel:hITTypeId:CreateHITWithHITType' :: CreateHITWithHITType -> Text
hITTypeId} -> Text
hITTypeId) (\s :: CreateHITWithHITType
s@CreateHITWithHITType' {} Text
a -> CreateHITWithHITType
s {$sel:hITTypeId:CreateHITWithHITType' :: Text
hITTypeId = Text
a} :: CreateHITWithHITType)

-- | 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.
createHITWithHITType_lifetimeInSeconds :: Lens.Lens' CreateHITWithHITType Prelude.Integer
createHITWithHITType_lifetimeInSeconds :: Lens' CreateHITWithHITType Integer
createHITWithHITType_lifetimeInSeconds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHITWithHITType' {Integer
lifetimeInSeconds :: Integer
$sel:lifetimeInSeconds:CreateHITWithHITType' :: CreateHITWithHITType -> Integer
lifetimeInSeconds} -> Integer
lifetimeInSeconds) (\s :: CreateHITWithHITType
s@CreateHITWithHITType' {} Integer
a -> CreateHITWithHITType
s {$sel:lifetimeInSeconds:CreateHITWithHITType' :: Integer
lifetimeInSeconds = Integer
a} :: CreateHITWithHITType)

instance Core.AWSRequest CreateHITWithHITType where
  type
    AWSResponse CreateHITWithHITType =
      CreateHITWithHITTypeResponse
  request :: (Service -> Service)
-> CreateHITWithHITType -> Request CreateHITWithHITType
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 CreateHITWithHITType
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateHITWithHITType)))
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 -> CreateHITWithHITTypeResponse
CreateHITWithHITTypeResponse'
            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 CreateHITWithHITType where
  hashWithSalt :: Int -> CreateHITWithHITType -> Int
hashWithSalt Int
_salt CreateHITWithHITType' {Integer
Maybe Int
Maybe [HITLayoutParameter]
Maybe Text
Maybe ReviewPolicy
Text
lifetimeInSeconds :: Integer
hITTypeId :: Text
uniqueRequestToken :: Maybe Text
requesterAnnotation :: Maybe Text
question :: Maybe Text
maxAssignments :: Maybe Int
hITReviewPolicy :: Maybe ReviewPolicy
hITLayoutParameters :: Maybe [HITLayoutParameter]
hITLayoutId :: Maybe Text
assignmentReviewPolicy :: Maybe ReviewPolicy
$sel:lifetimeInSeconds:CreateHITWithHITType' :: CreateHITWithHITType -> Integer
$sel:hITTypeId:CreateHITWithHITType' :: CreateHITWithHITType -> Text
$sel:uniqueRequestToken:CreateHITWithHITType' :: CreateHITWithHITType -> Maybe Text
$sel:requesterAnnotation:CreateHITWithHITType' :: CreateHITWithHITType -> Maybe Text
$sel:question:CreateHITWithHITType' :: CreateHITWithHITType -> Maybe Text
$sel:maxAssignments:CreateHITWithHITType' :: CreateHITWithHITType -> Maybe Int
$sel:hITReviewPolicy:CreateHITWithHITType' :: CreateHITWithHITType -> Maybe ReviewPolicy
$sel:hITLayoutParameters:CreateHITWithHITType' :: CreateHITWithHITType -> Maybe [HITLayoutParameter]
$sel:hITLayoutId:CreateHITWithHITType' :: CreateHITWithHITType -> Maybe Text
$sel:assignmentReviewPolicy:CreateHITWithHITType' :: CreateHITWithHITType -> 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 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 Int
maxAssignments
      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` Text
hITTypeId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Integer
lifetimeInSeconds

instance Prelude.NFData CreateHITWithHITType where
  rnf :: CreateHITWithHITType -> ()
rnf CreateHITWithHITType' {Integer
Maybe Int
Maybe [HITLayoutParameter]
Maybe Text
Maybe ReviewPolicy
Text
lifetimeInSeconds :: Integer
hITTypeId :: Text
uniqueRequestToken :: Maybe Text
requesterAnnotation :: Maybe Text
question :: Maybe Text
maxAssignments :: Maybe Int
hITReviewPolicy :: Maybe ReviewPolicy
hITLayoutParameters :: Maybe [HITLayoutParameter]
hITLayoutId :: Maybe Text
assignmentReviewPolicy :: Maybe ReviewPolicy
$sel:lifetimeInSeconds:CreateHITWithHITType' :: CreateHITWithHITType -> Integer
$sel:hITTypeId:CreateHITWithHITType' :: CreateHITWithHITType -> Text
$sel:uniqueRequestToken:CreateHITWithHITType' :: CreateHITWithHITType -> Maybe Text
$sel:requesterAnnotation:CreateHITWithHITType' :: CreateHITWithHITType -> Maybe Text
$sel:question:CreateHITWithHITType' :: CreateHITWithHITType -> Maybe Text
$sel:maxAssignments:CreateHITWithHITType' :: CreateHITWithHITType -> Maybe Int
$sel:hITReviewPolicy:CreateHITWithHITType' :: CreateHITWithHITType -> Maybe ReviewPolicy
$sel:hITLayoutParameters:CreateHITWithHITType' :: CreateHITWithHITType -> Maybe [HITLayoutParameter]
$sel:hITLayoutId:CreateHITWithHITType' :: CreateHITWithHITType -> Maybe Text
$sel:assignmentReviewPolicy:CreateHITWithHITType' :: CreateHITWithHITType -> 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 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 Int
maxAssignments
      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 Text
hITTypeId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Integer
lifetimeInSeconds

instance Data.ToHeaders CreateHITWithHITType where
  toHeaders :: CreateHITWithHITType -> 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.CreateHITWithHITType" ::
                          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 CreateHITWithHITType where
  toJSON :: CreateHITWithHITType -> Value
toJSON CreateHITWithHITType' {Integer
Maybe Int
Maybe [HITLayoutParameter]
Maybe Text
Maybe ReviewPolicy
Text
lifetimeInSeconds :: Integer
hITTypeId :: Text
uniqueRequestToken :: Maybe Text
requesterAnnotation :: Maybe Text
question :: Maybe Text
maxAssignments :: Maybe Int
hITReviewPolicy :: Maybe ReviewPolicy
hITLayoutParameters :: Maybe [HITLayoutParameter]
hITLayoutId :: Maybe Text
assignmentReviewPolicy :: Maybe ReviewPolicy
$sel:lifetimeInSeconds:CreateHITWithHITType' :: CreateHITWithHITType -> Integer
$sel:hITTypeId:CreateHITWithHITType' :: CreateHITWithHITType -> Text
$sel:uniqueRequestToken:CreateHITWithHITType' :: CreateHITWithHITType -> Maybe Text
$sel:requesterAnnotation:CreateHITWithHITType' :: CreateHITWithHITType -> Maybe Text
$sel:question:CreateHITWithHITType' :: CreateHITWithHITType -> Maybe Text
$sel:maxAssignments:CreateHITWithHITType' :: CreateHITWithHITType -> Maybe Int
$sel:hITReviewPolicy:CreateHITWithHITType' :: CreateHITWithHITType -> Maybe ReviewPolicy
$sel:hITLayoutParameters:CreateHITWithHITType' :: CreateHITWithHITType -> Maybe [HITLayoutParameter]
$sel:hITLayoutId:CreateHITWithHITType' :: CreateHITWithHITType -> Maybe Text
$sel:assignmentReviewPolicy:CreateHITWithHITType' :: CreateHITWithHITType -> 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
"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
"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
"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
"HITTypeId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
hITTypeId),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"LifetimeInSeconds" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Integer
lifetimeInSeconds)
          ]
      )

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

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

-- | /See:/ 'newCreateHITWithHITTypeResponse' smart constructor.
data CreateHITWithHITTypeResponse = CreateHITWithHITTypeResponse'
  { -- | 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.
    CreateHITWithHITTypeResponse -> Maybe HIT
hit :: Prelude.Maybe HIT,
    -- | The response's http status code.
    CreateHITWithHITTypeResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateHITWithHITTypeResponse
-> CreateHITWithHITTypeResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateHITWithHITTypeResponse
-> CreateHITWithHITTypeResponse -> Bool
$c/= :: CreateHITWithHITTypeResponse
-> CreateHITWithHITTypeResponse -> Bool
== :: CreateHITWithHITTypeResponse
-> CreateHITWithHITTypeResponse -> Bool
$c== :: CreateHITWithHITTypeResponse
-> CreateHITWithHITTypeResponse -> Bool
Prelude.Eq, ReadPrec [CreateHITWithHITTypeResponse]
ReadPrec CreateHITWithHITTypeResponse
Int -> ReadS CreateHITWithHITTypeResponse
ReadS [CreateHITWithHITTypeResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateHITWithHITTypeResponse]
$creadListPrec :: ReadPrec [CreateHITWithHITTypeResponse]
readPrec :: ReadPrec CreateHITWithHITTypeResponse
$creadPrec :: ReadPrec CreateHITWithHITTypeResponse
readList :: ReadS [CreateHITWithHITTypeResponse]
$creadList :: ReadS [CreateHITWithHITTypeResponse]
readsPrec :: Int -> ReadS CreateHITWithHITTypeResponse
$creadsPrec :: Int -> ReadS CreateHITWithHITTypeResponse
Prelude.Read, Int -> CreateHITWithHITTypeResponse -> ShowS
[CreateHITWithHITTypeResponse] -> ShowS
CreateHITWithHITTypeResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateHITWithHITTypeResponse] -> ShowS
$cshowList :: [CreateHITWithHITTypeResponse] -> ShowS
show :: CreateHITWithHITTypeResponse -> String
$cshow :: CreateHITWithHITTypeResponse -> String
showsPrec :: Int -> CreateHITWithHITTypeResponse -> ShowS
$cshowsPrec :: Int -> CreateHITWithHITTypeResponse -> ShowS
Prelude.Show, forall x.
Rep CreateHITWithHITTypeResponse x -> CreateHITWithHITTypeResponse
forall x.
CreateHITWithHITTypeResponse -> Rep CreateHITWithHITTypeResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateHITWithHITTypeResponse x -> CreateHITWithHITTypeResponse
$cfrom :: forall x.
CreateHITWithHITTypeResponse -> Rep CreateHITWithHITTypeResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateHITWithHITTypeResponse' 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', 'createHITWithHITTypeResponse_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', 'createHITWithHITTypeResponse_httpStatus' - The response's http status code.
newCreateHITWithHITTypeResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateHITWithHITTypeResponse
newCreateHITWithHITTypeResponse :: Int -> CreateHITWithHITTypeResponse
newCreateHITWithHITTypeResponse Int
pHttpStatus_ =
  CreateHITWithHITTypeResponse'
    { $sel:hit:CreateHITWithHITTypeResponse' :: Maybe HIT
hit =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateHITWithHITTypeResponse' :: 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.
createHITWithHITTypeResponse_hit :: Lens.Lens' CreateHITWithHITTypeResponse (Prelude.Maybe HIT)
createHITWithHITTypeResponse_hit :: Lens' CreateHITWithHITTypeResponse (Maybe HIT)
createHITWithHITTypeResponse_hit = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateHITWithHITTypeResponse' {Maybe HIT
hit :: Maybe HIT
$sel:hit:CreateHITWithHITTypeResponse' :: CreateHITWithHITTypeResponse -> Maybe HIT
hit} -> Maybe HIT
hit) (\s :: CreateHITWithHITTypeResponse
s@CreateHITWithHITTypeResponse' {} Maybe HIT
a -> CreateHITWithHITTypeResponse
s {$sel:hit:CreateHITWithHITTypeResponse' :: Maybe HIT
hit = Maybe HIT
a} :: CreateHITWithHITTypeResponse)

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

instance Prelude.NFData CreateHITWithHITTypeResponse where
  rnf :: CreateHITWithHITTypeResponse -> ()
rnf CreateHITWithHITTypeResponse' {Int
Maybe HIT
httpStatus :: Int
hit :: Maybe HIT
$sel:httpStatus:CreateHITWithHITTypeResponse' :: CreateHITWithHITTypeResponse -> Int
$sel:hit:CreateHITWithHITTypeResponse' :: CreateHITWithHITTypeResponse -> 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