{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.MechanicalTurk.Types.ReviewResultDetail
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.MechanicalTurk.Types.ReviewResultDetail where

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

-- | This data structure is returned multiple times for each result specified
-- in the Review Policy.
--
-- /See:/ 'newReviewResultDetail' smart constructor.
data ReviewResultDetail = ReviewResultDetail'
  { -- | The values of Key provided by the review policies you have selected.
    ReviewResultDetail -> Maybe Text
value :: Prelude.Maybe Prelude.Text,
    -- | A unique identifier of the Review action result.
    ReviewResultDetail -> Maybe Text
actionId :: Prelude.Maybe Prelude.Text,
    -- | The type of the object from the SubjectId field.
    ReviewResultDetail -> Maybe Text
subjectType :: Prelude.Maybe Prelude.Text,
    -- | Key identifies the particular piece of reviewed information.
    ReviewResultDetail -> Maybe Text
key :: Prelude.Maybe Prelude.Text,
    -- | Specifies the QuestionId the result is describing. Depending on whether
    -- the TargetType is a HIT or Assignment this results could specify
    -- multiple values. If TargetType is HIT and QuestionId is absent, then the
    -- result describes results of the HIT, including the HIT agreement score.
    -- If ObjectType is Assignment and QuestionId is absent, then the result
    -- describes the Worker\'s performance on the HIT.
    ReviewResultDetail -> Maybe Text
questionId :: Prelude.Maybe Prelude.Text,
    -- | The HITID or AssignmentId about which this result was taken. Note that
    -- HIT-level Review Policies will often emit results about both the HIT
    -- itself and its Assignments, while Assignment-level review policies
    -- generally only emit results about the Assignment itself.
    ReviewResultDetail -> Maybe Text
subjectId :: Prelude.Maybe Prelude.Text
  }
  deriving (ReviewResultDetail -> ReviewResultDetail -> Bool
(ReviewResultDetail -> ReviewResultDetail -> Bool)
-> (ReviewResultDetail -> ReviewResultDetail -> Bool)
-> Eq ReviewResultDetail
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ReviewResultDetail -> ReviewResultDetail -> Bool
$c/= :: ReviewResultDetail -> ReviewResultDetail -> Bool
== :: ReviewResultDetail -> ReviewResultDetail -> Bool
$c== :: ReviewResultDetail -> ReviewResultDetail -> Bool
Prelude.Eq, ReadPrec [ReviewResultDetail]
ReadPrec ReviewResultDetail
Int -> ReadS ReviewResultDetail
ReadS [ReviewResultDetail]
(Int -> ReadS ReviewResultDetail)
-> ReadS [ReviewResultDetail]
-> ReadPrec ReviewResultDetail
-> ReadPrec [ReviewResultDetail]
-> Read ReviewResultDetail
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ReviewResultDetail]
$creadListPrec :: ReadPrec [ReviewResultDetail]
readPrec :: ReadPrec ReviewResultDetail
$creadPrec :: ReadPrec ReviewResultDetail
readList :: ReadS [ReviewResultDetail]
$creadList :: ReadS [ReviewResultDetail]
readsPrec :: Int -> ReadS ReviewResultDetail
$creadsPrec :: Int -> ReadS ReviewResultDetail
Prelude.Read, Int -> ReviewResultDetail -> ShowS
[ReviewResultDetail] -> ShowS
ReviewResultDetail -> String
(Int -> ReviewResultDetail -> ShowS)
-> (ReviewResultDetail -> String)
-> ([ReviewResultDetail] -> ShowS)
-> Show ReviewResultDetail
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ReviewResultDetail] -> ShowS
$cshowList :: [ReviewResultDetail] -> ShowS
show :: ReviewResultDetail -> String
$cshow :: ReviewResultDetail -> String
showsPrec :: Int -> ReviewResultDetail -> ShowS
$cshowsPrec :: Int -> ReviewResultDetail -> ShowS
Prelude.Show, (forall x. ReviewResultDetail -> Rep ReviewResultDetail x)
-> (forall x. Rep ReviewResultDetail x -> ReviewResultDetail)
-> Generic ReviewResultDetail
forall x. Rep ReviewResultDetail x -> ReviewResultDetail
forall x. ReviewResultDetail -> Rep ReviewResultDetail x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ReviewResultDetail x -> ReviewResultDetail
$cfrom :: forall x. ReviewResultDetail -> Rep ReviewResultDetail x
Prelude.Generic)

-- |
-- Create a value of 'ReviewResultDetail' 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:
--
-- 'value', 'reviewResultDetail_value' - The values of Key provided by the review policies you have selected.
--
-- 'actionId', 'reviewResultDetail_actionId' - A unique identifier of the Review action result.
--
-- 'subjectType', 'reviewResultDetail_subjectType' - The type of the object from the SubjectId field.
--
-- 'key', 'reviewResultDetail_key' - Key identifies the particular piece of reviewed information.
--
-- 'questionId', 'reviewResultDetail_questionId' - Specifies the QuestionId the result is describing. Depending on whether
-- the TargetType is a HIT or Assignment this results could specify
-- multiple values. If TargetType is HIT and QuestionId is absent, then the
-- result describes results of the HIT, including the HIT agreement score.
-- If ObjectType is Assignment and QuestionId is absent, then the result
-- describes the Worker\'s performance on the HIT.
--
-- 'subjectId', 'reviewResultDetail_subjectId' - The HITID or AssignmentId about which this result was taken. Note that
-- HIT-level Review Policies will often emit results about both the HIT
-- itself and its Assignments, while Assignment-level review policies
-- generally only emit results about the Assignment itself.
newReviewResultDetail ::
  ReviewResultDetail
newReviewResultDetail :: ReviewResultDetail
newReviewResultDetail =
  ReviewResultDetail' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> ReviewResultDetail
ReviewResultDetail'
    { $sel:value:ReviewResultDetail' :: Maybe Text
value = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:actionId:ReviewResultDetail' :: Maybe Text
actionId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:subjectType:ReviewResultDetail' :: Maybe Text
subjectType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:key:ReviewResultDetail' :: Maybe Text
key = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:questionId:ReviewResultDetail' :: Maybe Text
questionId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:subjectId:ReviewResultDetail' :: Maybe Text
subjectId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The values of Key provided by the review policies you have selected.
reviewResultDetail_value :: Lens.Lens' ReviewResultDetail (Prelude.Maybe Prelude.Text)
reviewResultDetail_value :: (Maybe Text -> f (Maybe Text))
-> ReviewResultDetail -> f ReviewResultDetail
reviewResultDetail_value = (ReviewResultDetail -> Maybe Text)
-> (ReviewResultDetail -> Maybe Text -> ReviewResultDetail)
-> Lens
     ReviewResultDetail ReviewResultDetail (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReviewResultDetail' {Maybe Text
value :: Maybe Text
$sel:value:ReviewResultDetail' :: ReviewResultDetail -> Maybe Text
value} -> Maybe Text
value) (\s :: ReviewResultDetail
s@ReviewResultDetail' {} Maybe Text
a -> ReviewResultDetail
s {$sel:value:ReviewResultDetail' :: Maybe Text
value = Maybe Text
a} :: ReviewResultDetail)

-- | A unique identifier of the Review action result.
reviewResultDetail_actionId :: Lens.Lens' ReviewResultDetail (Prelude.Maybe Prelude.Text)
reviewResultDetail_actionId :: (Maybe Text -> f (Maybe Text))
-> ReviewResultDetail -> f ReviewResultDetail
reviewResultDetail_actionId = (ReviewResultDetail -> Maybe Text)
-> (ReviewResultDetail -> Maybe Text -> ReviewResultDetail)
-> Lens
     ReviewResultDetail ReviewResultDetail (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReviewResultDetail' {Maybe Text
actionId :: Maybe Text
$sel:actionId:ReviewResultDetail' :: ReviewResultDetail -> Maybe Text
actionId} -> Maybe Text
actionId) (\s :: ReviewResultDetail
s@ReviewResultDetail' {} Maybe Text
a -> ReviewResultDetail
s {$sel:actionId:ReviewResultDetail' :: Maybe Text
actionId = Maybe Text
a} :: ReviewResultDetail)

-- | The type of the object from the SubjectId field.
reviewResultDetail_subjectType :: Lens.Lens' ReviewResultDetail (Prelude.Maybe Prelude.Text)
reviewResultDetail_subjectType :: (Maybe Text -> f (Maybe Text))
-> ReviewResultDetail -> f ReviewResultDetail
reviewResultDetail_subjectType = (ReviewResultDetail -> Maybe Text)
-> (ReviewResultDetail -> Maybe Text -> ReviewResultDetail)
-> Lens
     ReviewResultDetail ReviewResultDetail (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReviewResultDetail' {Maybe Text
subjectType :: Maybe Text
$sel:subjectType:ReviewResultDetail' :: ReviewResultDetail -> Maybe Text
subjectType} -> Maybe Text
subjectType) (\s :: ReviewResultDetail
s@ReviewResultDetail' {} Maybe Text
a -> ReviewResultDetail
s {$sel:subjectType:ReviewResultDetail' :: Maybe Text
subjectType = Maybe Text
a} :: ReviewResultDetail)

-- | Key identifies the particular piece of reviewed information.
reviewResultDetail_key :: Lens.Lens' ReviewResultDetail (Prelude.Maybe Prelude.Text)
reviewResultDetail_key :: (Maybe Text -> f (Maybe Text))
-> ReviewResultDetail -> f ReviewResultDetail
reviewResultDetail_key = (ReviewResultDetail -> Maybe Text)
-> (ReviewResultDetail -> Maybe Text -> ReviewResultDetail)
-> Lens
     ReviewResultDetail ReviewResultDetail (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReviewResultDetail' {Maybe Text
key :: Maybe Text
$sel:key:ReviewResultDetail' :: ReviewResultDetail -> Maybe Text
key} -> Maybe Text
key) (\s :: ReviewResultDetail
s@ReviewResultDetail' {} Maybe Text
a -> ReviewResultDetail
s {$sel:key:ReviewResultDetail' :: Maybe Text
key = Maybe Text
a} :: ReviewResultDetail)

-- | Specifies the QuestionId the result is describing. Depending on whether
-- the TargetType is a HIT or Assignment this results could specify
-- multiple values. If TargetType is HIT and QuestionId is absent, then the
-- result describes results of the HIT, including the HIT agreement score.
-- If ObjectType is Assignment and QuestionId is absent, then the result
-- describes the Worker\'s performance on the HIT.
reviewResultDetail_questionId :: Lens.Lens' ReviewResultDetail (Prelude.Maybe Prelude.Text)
reviewResultDetail_questionId :: (Maybe Text -> f (Maybe Text))
-> ReviewResultDetail -> f ReviewResultDetail
reviewResultDetail_questionId = (ReviewResultDetail -> Maybe Text)
-> (ReviewResultDetail -> Maybe Text -> ReviewResultDetail)
-> Lens
     ReviewResultDetail ReviewResultDetail (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReviewResultDetail' {Maybe Text
questionId :: Maybe Text
$sel:questionId:ReviewResultDetail' :: ReviewResultDetail -> Maybe Text
questionId} -> Maybe Text
questionId) (\s :: ReviewResultDetail
s@ReviewResultDetail' {} Maybe Text
a -> ReviewResultDetail
s {$sel:questionId:ReviewResultDetail' :: Maybe Text
questionId = Maybe Text
a} :: ReviewResultDetail)

-- | The HITID or AssignmentId about which this result was taken. Note that
-- HIT-level Review Policies will often emit results about both the HIT
-- itself and its Assignments, while Assignment-level review policies
-- generally only emit results about the Assignment itself.
reviewResultDetail_subjectId :: Lens.Lens' ReviewResultDetail (Prelude.Maybe Prelude.Text)
reviewResultDetail_subjectId :: (Maybe Text -> f (Maybe Text))
-> ReviewResultDetail -> f ReviewResultDetail
reviewResultDetail_subjectId = (ReviewResultDetail -> Maybe Text)
-> (ReviewResultDetail -> Maybe Text -> ReviewResultDetail)
-> Lens
     ReviewResultDetail ReviewResultDetail (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReviewResultDetail' {Maybe Text
subjectId :: Maybe Text
$sel:subjectId:ReviewResultDetail' :: ReviewResultDetail -> Maybe Text
subjectId} -> Maybe Text
subjectId) (\s :: ReviewResultDetail
s@ReviewResultDetail' {} Maybe Text
a -> ReviewResultDetail
s {$sel:subjectId:ReviewResultDetail' :: Maybe Text
subjectId = Maybe Text
a} :: ReviewResultDetail)

instance Core.FromJSON ReviewResultDetail where
  parseJSON :: Value -> Parser ReviewResultDetail
parseJSON =
    String
-> (Object -> Parser ReviewResultDetail)
-> Value
-> Parser ReviewResultDetail
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ReviewResultDetail"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> ReviewResultDetail
ReviewResultDetail'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> ReviewResultDetail)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> ReviewResultDetail)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Value")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> ReviewResultDetail)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe Text -> Maybe Text -> ReviewResultDetail)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ActionId")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe Text -> Maybe Text -> ReviewResultDetail)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe Text -> ReviewResultDetail)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SubjectType")
            Parser
  (Maybe Text -> Maybe Text -> Maybe Text -> ReviewResultDetail)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> ReviewResultDetail)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Key")
            Parser (Maybe Text -> Maybe Text -> ReviewResultDetail)
-> Parser (Maybe Text) -> Parser (Maybe Text -> ReviewResultDetail)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"QuestionId")
            Parser (Maybe Text -> ReviewResultDetail)
-> Parser (Maybe Text) -> Parser ReviewResultDetail
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SubjectId")
      )

instance Prelude.Hashable ReviewResultDetail

instance Prelude.NFData ReviewResultDetail