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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MechanicalTurk.Types.ReviewActionDetail
import Amazonka.MechanicalTurk.Types.ReviewResultDetail
import qualified Amazonka.Prelude as Prelude

-- | Contains both ReviewResult and ReviewAction elements for a particular
-- HIT.
--
-- /See:/ 'newReviewReport' smart constructor.
data ReviewReport = ReviewReport'
  { -- | A list of ReviewAction objects for each action specified in the Review
    -- Policy.
    ReviewReport -> Maybe [ReviewActionDetail]
reviewActions :: Prelude.Maybe [ReviewActionDetail],
    -- | A list of ReviewResults objects for each action specified in the Review
    -- Policy.
    ReviewReport -> Maybe [ReviewResultDetail]
reviewResults :: Prelude.Maybe [ReviewResultDetail]
  }
  deriving (ReviewReport -> ReviewReport -> Bool
(ReviewReport -> ReviewReport -> Bool)
-> (ReviewReport -> ReviewReport -> Bool) -> Eq ReviewReport
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ReviewReport -> ReviewReport -> Bool
$c/= :: ReviewReport -> ReviewReport -> Bool
== :: ReviewReport -> ReviewReport -> Bool
$c== :: ReviewReport -> ReviewReport -> Bool
Prelude.Eq, ReadPrec [ReviewReport]
ReadPrec ReviewReport
Int -> ReadS ReviewReport
ReadS [ReviewReport]
(Int -> ReadS ReviewReport)
-> ReadS [ReviewReport]
-> ReadPrec ReviewReport
-> ReadPrec [ReviewReport]
-> Read ReviewReport
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ReviewReport]
$creadListPrec :: ReadPrec [ReviewReport]
readPrec :: ReadPrec ReviewReport
$creadPrec :: ReadPrec ReviewReport
readList :: ReadS [ReviewReport]
$creadList :: ReadS [ReviewReport]
readsPrec :: Int -> ReadS ReviewReport
$creadsPrec :: Int -> ReadS ReviewReport
Prelude.Read, Int -> ReviewReport -> ShowS
[ReviewReport] -> ShowS
ReviewReport -> String
(Int -> ReviewReport -> ShowS)
-> (ReviewReport -> String)
-> ([ReviewReport] -> ShowS)
-> Show ReviewReport
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ReviewReport] -> ShowS
$cshowList :: [ReviewReport] -> ShowS
show :: ReviewReport -> String
$cshow :: ReviewReport -> String
showsPrec :: Int -> ReviewReport -> ShowS
$cshowsPrec :: Int -> ReviewReport -> ShowS
Prelude.Show, (forall x. ReviewReport -> Rep ReviewReport x)
-> (forall x. Rep ReviewReport x -> ReviewReport)
-> Generic ReviewReport
forall x. Rep ReviewReport x -> ReviewReport
forall x. ReviewReport -> Rep ReviewReport x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ReviewReport x -> ReviewReport
$cfrom :: forall x. ReviewReport -> Rep ReviewReport x
Prelude.Generic)

-- |
-- Create a value of 'ReviewReport' 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:
--
-- 'reviewActions', 'reviewReport_reviewActions' - A list of ReviewAction objects for each action specified in the Review
-- Policy.
--
-- 'reviewResults', 'reviewReport_reviewResults' - A list of ReviewResults objects for each action specified in the Review
-- Policy.
newReviewReport ::
  ReviewReport
newReviewReport :: ReviewReport
newReviewReport =
  ReviewReport' :: Maybe [ReviewActionDetail]
-> Maybe [ReviewResultDetail] -> ReviewReport
ReviewReport'
    { $sel:reviewActions:ReviewReport' :: Maybe [ReviewActionDetail]
reviewActions = Maybe [ReviewActionDetail]
forall a. Maybe a
Prelude.Nothing,
      $sel:reviewResults:ReviewReport' :: Maybe [ReviewResultDetail]
reviewResults = Maybe [ReviewResultDetail]
forall a. Maybe a
Prelude.Nothing
    }

-- | A list of ReviewAction objects for each action specified in the Review
-- Policy.
reviewReport_reviewActions :: Lens.Lens' ReviewReport (Prelude.Maybe [ReviewActionDetail])
reviewReport_reviewActions :: (Maybe [ReviewActionDetail] -> f (Maybe [ReviewActionDetail]))
-> ReviewReport -> f ReviewReport
reviewReport_reviewActions = (ReviewReport -> Maybe [ReviewActionDetail])
-> (ReviewReport -> Maybe [ReviewActionDetail] -> ReviewReport)
-> Lens
     ReviewReport
     ReviewReport
     (Maybe [ReviewActionDetail])
     (Maybe [ReviewActionDetail])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReviewReport' {Maybe [ReviewActionDetail]
reviewActions :: Maybe [ReviewActionDetail]
$sel:reviewActions:ReviewReport' :: ReviewReport -> Maybe [ReviewActionDetail]
reviewActions} -> Maybe [ReviewActionDetail]
reviewActions) (\s :: ReviewReport
s@ReviewReport' {} Maybe [ReviewActionDetail]
a -> ReviewReport
s {$sel:reviewActions:ReviewReport' :: Maybe [ReviewActionDetail]
reviewActions = Maybe [ReviewActionDetail]
a} :: ReviewReport) ((Maybe [ReviewActionDetail] -> f (Maybe [ReviewActionDetail]))
 -> ReviewReport -> f ReviewReport)
-> ((Maybe [ReviewActionDetail] -> f (Maybe [ReviewActionDetail]))
    -> Maybe [ReviewActionDetail] -> f (Maybe [ReviewActionDetail]))
-> (Maybe [ReviewActionDetail] -> f (Maybe [ReviewActionDetail]))
-> ReviewReport
-> f ReviewReport
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ReviewActionDetail]
  [ReviewActionDetail]
  [ReviewActionDetail]
  [ReviewActionDetail]
-> Iso
     (Maybe [ReviewActionDetail])
     (Maybe [ReviewActionDetail])
     (Maybe [ReviewActionDetail])
     (Maybe [ReviewActionDetail])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [ReviewActionDetail]
  [ReviewActionDetail]
  [ReviewActionDetail]
  [ReviewActionDetail]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A list of ReviewResults objects for each action specified in the Review
-- Policy.
reviewReport_reviewResults :: Lens.Lens' ReviewReport (Prelude.Maybe [ReviewResultDetail])
reviewReport_reviewResults :: (Maybe [ReviewResultDetail] -> f (Maybe [ReviewResultDetail]))
-> ReviewReport -> f ReviewReport
reviewReport_reviewResults = (ReviewReport -> Maybe [ReviewResultDetail])
-> (ReviewReport -> Maybe [ReviewResultDetail] -> ReviewReport)
-> Lens
     ReviewReport
     ReviewReport
     (Maybe [ReviewResultDetail])
     (Maybe [ReviewResultDetail])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReviewReport' {Maybe [ReviewResultDetail]
reviewResults :: Maybe [ReviewResultDetail]
$sel:reviewResults:ReviewReport' :: ReviewReport -> Maybe [ReviewResultDetail]
reviewResults} -> Maybe [ReviewResultDetail]
reviewResults) (\s :: ReviewReport
s@ReviewReport' {} Maybe [ReviewResultDetail]
a -> ReviewReport
s {$sel:reviewResults:ReviewReport' :: Maybe [ReviewResultDetail]
reviewResults = Maybe [ReviewResultDetail]
a} :: ReviewReport) ((Maybe [ReviewResultDetail] -> f (Maybe [ReviewResultDetail]))
 -> ReviewReport -> f ReviewReport)
-> ((Maybe [ReviewResultDetail] -> f (Maybe [ReviewResultDetail]))
    -> Maybe [ReviewResultDetail] -> f (Maybe [ReviewResultDetail]))
-> (Maybe [ReviewResultDetail] -> f (Maybe [ReviewResultDetail]))
-> ReviewReport
-> f ReviewReport
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ReviewResultDetail]
  [ReviewResultDetail]
  [ReviewResultDetail]
  [ReviewResultDetail]
-> Iso
     (Maybe [ReviewResultDetail])
     (Maybe [ReviewResultDetail])
     (Maybe [ReviewResultDetail])
     (Maybe [ReviewResultDetail])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [ReviewResultDetail]
  [ReviewResultDetail]
  [ReviewResultDetail]
  [ReviewResultDetail]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON ReviewReport where
  parseJSON :: Value -> Parser ReviewReport
parseJSON =
    String
-> (Object -> Parser ReviewReport) -> Value -> Parser ReviewReport
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ReviewReport"
      ( \Object
x ->
          Maybe [ReviewActionDetail]
-> Maybe [ReviewResultDetail] -> ReviewReport
ReviewReport'
            (Maybe [ReviewActionDetail]
 -> Maybe [ReviewResultDetail] -> ReviewReport)
-> Parser (Maybe [ReviewActionDetail])
-> Parser (Maybe [ReviewResultDetail] -> ReviewReport)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [ReviewActionDetail]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ReviewActions" Parser (Maybe (Maybe [ReviewActionDetail]))
-> Maybe [ReviewActionDetail]
-> Parser (Maybe [ReviewActionDetail])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [ReviewActionDetail]
forall a. Monoid a => a
Prelude.mempty)
            Parser (Maybe [ReviewResultDetail] -> ReviewReport)
-> Parser (Maybe [ReviewResultDetail]) -> Parser ReviewReport
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [ReviewResultDetail]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ReviewResults" Parser (Maybe (Maybe [ReviewResultDetail]))
-> Maybe [ReviewResultDetail]
-> Parser (Maybe [ReviewResultDetail])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [ReviewResultDetail]
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable ReviewReport

instance Prelude.NFData ReviewReport