{-# 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.Textract.Types.HumanLoopActivationOutput
-- 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.Textract.Types.HumanLoopActivationOutput where

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

-- | Shows the results of the human in the loop evaluation. If there is no
-- HumanLoopArn, the input did not trigger human review.
--
-- /See:/ 'newHumanLoopActivationOutput' smart constructor.
data HumanLoopActivationOutput = HumanLoopActivationOutput'
  { -- | Shows if and why human review was needed.
    HumanLoopActivationOutput -> Maybe (NonEmpty Text)
humanLoopActivationReasons :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
    -- | The Amazon Resource Name (ARN) of the HumanLoop created.
    HumanLoopActivationOutput -> Maybe Text
humanLoopArn :: Prelude.Maybe Prelude.Text,
    -- | Shows the result of condition evaluations, including those conditions
    -- which activated a human review.
    HumanLoopActivationOutput -> Maybe Text
humanLoopActivationConditionsEvaluationResults :: Prelude.Maybe Prelude.Text
  }
  deriving (HumanLoopActivationOutput -> HumanLoopActivationOutput -> Bool
(HumanLoopActivationOutput -> HumanLoopActivationOutput -> Bool)
-> (HumanLoopActivationOutput -> HumanLoopActivationOutput -> Bool)
-> Eq HumanLoopActivationOutput
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HumanLoopActivationOutput -> HumanLoopActivationOutput -> Bool
$c/= :: HumanLoopActivationOutput -> HumanLoopActivationOutput -> Bool
== :: HumanLoopActivationOutput -> HumanLoopActivationOutput -> Bool
$c== :: HumanLoopActivationOutput -> HumanLoopActivationOutput -> Bool
Prelude.Eq, ReadPrec [HumanLoopActivationOutput]
ReadPrec HumanLoopActivationOutput
Int -> ReadS HumanLoopActivationOutput
ReadS [HumanLoopActivationOutput]
(Int -> ReadS HumanLoopActivationOutput)
-> ReadS [HumanLoopActivationOutput]
-> ReadPrec HumanLoopActivationOutput
-> ReadPrec [HumanLoopActivationOutput]
-> Read HumanLoopActivationOutput
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [HumanLoopActivationOutput]
$creadListPrec :: ReadPrec [HumanLoopActivationOutput]
readPrec :: ReadPrec HumanLoopActivationOutput
$creadPrec :: ReadPrec HumanLoopActivationOutput
readList :: ReadS [HumanLoopActivationOutput]
$creadList :: ReadS [HumanLoopActivationOutput]
readsPrec :: Int -> ReadS HumanLoopActivationOutput
$creadsPrec :: Int -> ReadS HumanLoopActivationOutput
Prelude.Read, Int -> HumanLoopActivationOutput -> ShowS
[HumanLoopActivationOutput] -> ShowS
HumanLoopActivationOutput -> String
(Int -> HumanLoopActivationOutput -> ShowS)
-> (HumanLoopActivationOutput -> String)
-> ([HumanLoopActivationOutput] -> ShowS)
-> Show HumanLoopActivationOutput
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HumanLoopActivationOutput] -> ShowS
$cshowList :: [HumanLoopActivationOutput] -> ShowS
show :: HumanLoopActivationOutput -> String
$cshow :: HumanLoopActivationOutput -> String
showsPrec :: Int -> HumanLoopActivationOutput -> ShowS
$cshowsPrec :: Int -> HumanLoopActivationOutput -> ShowS
Prelude.Show, (forall x.
 HumanLoopActivationOutput -> Rep HumanLoopActivationOutput x)
-> (forall x.
    Rep HumanLoopActivationOutput x -> HumanLoopActivationOutput)
-> Generic HumanLoopActivationOutput
forall x.
Rep HumanLoopActivationOutput x -> HumanLoopActivationOutput
forall x.
HumanLoopActivationOutput -> Rep HumanLoopActivationOutput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep HumanLoopActivationOutput x -> HumanLoopActivationOutput
$cfrom :: forall x.
HumanLoopActivationOutput -> Rep HumanLoopActivationOutput x
Prelude.Generic)

-- |
-- Create a value of 'HumanLoopActivationOutput' 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:
--
-- 'humanLoopActivationReasons', 'humanLoopActivationOutput_humanLoopActivationReasons' - Shows if and why human review was needed.
--
-- 'humanLoopArn', 'humanLoopActivationOutput_humanLoopArn' - The Amazon Resource Name (ARN) of the HumanLoop created.
--
-- 'humanLoopActivationConditionsEvaluationResults', 'humanLoopActivationOutput_humanLoopActivationConditionsEvaluationResults' - Shows the result of condition evaluations, including those conditions
-- which activated a human review.
newHumanLoopActivationOutput ::
  HumanLoopActivationOutput
newHumanLoopActivationOutput :: HumanLoopActivationOutput
newHumanLoopActivationOutput =
  HumanLoopActivationOutput' :: Maybe (NonEmpty Text)
-> Maybe Text -> Maybe Text -> HumanLoopActivationOutput
HumanLoopActivationOutput'
    { $sel:humanLoopActivationReasons:HumanLoopActivationOutput' :: Maybe (NonEmpty Text)
humanLoopActivationReasons =
        Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:humanLoopArn:HumanLoopActivationOutput' :: Maybe Text
humanLoopArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:humanLoopActivationConditionsEvaluationResults:HumanLoopActivationOutput' :: Maybe Text
humanLoopActivationConditionsEvaluationResults =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Shows if and why human review was needed.
humanLoopActivationOutput_humanLoopActivationReasons :: Lens.Lens' HumanLoopActivationOutput (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
humanLoopActivationOutput_humanLoopActivationReasons :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> HumanLoopActivationOutput -> f HumanLoopActivationOutput
humanLoopActivationOutput_humanLoopActivationReasons = (HumanLoopActivationOutput -> Maybe (NonEmpty Text))
-> (HumanLoopActivationOutput
    -> Maybe (NonEmpty Text) -> HumanLoopActivationOutput)
-> Lens
     HumanLoopActivationOutput
     HumanLoopActivationOutput
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HumanLoopActivationOutput' {Maybe (NonEmpty Text)
humanLoopActivationReasons :: Maybe (NonEmpty Text)
$sel:humanLoopActivationReasons:HumanLoopActivationOutput' :: HumanLoopActivationOutput -> Maybe (NonEmpty Text)
humanLoopActivationReasons} -> Maybe (NonEmpty Text)
humanLoopActivationReasons) (\s :: HumanLoopActivationOutput
s@HumanLoopActivationOutput' {} Maybe (NonEmpty Text)
a -> HumanLoopActivationOutput
s {$sel:humanLoopActivationReasons:HumanLoopActivationOutput' :: Maybe (NonEmpty Text)
humanLoopActivationReasons = Maybe (NonEmpty Text)
a} :: HumanLoopActivationOutput) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
 -> HumanLoopActivationOutput -> f HumanLoopActivationOutput)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
    -> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> HumanLoopActivationOutput
-> f HumanLoopActivationOutput
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
-> Iso
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
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
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The Amazon Resource Name (ARN) of the HumanLoop created.
humanLoopActivationOutput_humanLoopArn :: Lens.Lens' HumanLoopActivationOutput (Prelude.Maybe Prelude.Text)
humanLoopActivationOutput_humanLoopArn :: (Maybe Text -> f (Maybe Text))
-> HumanLoopActivationOutput -> f HumanLoopActivationOutput
humanLoopActivationOutput_humanLoopArn = (HumanLoopActivationOutput -> Maybe Text)
-> (HumanLoopActivationOutput
    -> Maybe Text -> HumanLoopActivationOutput)
-> Lens
     HumanLoopActivationOutput
     HumanLoopActivationOutput
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HumanLoopActivationOutput' {Maybe Text
humanLoopArn :: Maybe Text
$sel:humanLoopArn:HumanLoopActivationOutput' :: HumanLoopActivationOutput -> Maybe Text
humanLoopArn} -> Maybe Text
humanLoopArn) (\s :: HumanLoopActivationOutput
s@HumanLoopActivationOutput' {} Maybe Text
a -> HumanLoopActivationOutput
s {$sel:humanLoopArn:HumanLoopActivationOutput' :: Maybe Text
humanLoopArn = Maybe Text
a} :: HumanLoopActivationOutput)

-- | Shows the result of condition evaluations, including those conditions
-- which activated a human review.
humanLoopActivationOutput_humanLoopActivationConditionsEvaluationResults :: Lens.Lens' HumanLoopActivationOutput (Prelude.Maybe Prelude.Text)
humanLoopActivationOutput_humanLoopActivationConditionsEvaluationResults :: (Maybe Text -> f (Maybe Text))
-> HumanLoopActivationOutput -> f HumanLoopActivationOutput
humanLoopActivationOutput_humanLoopActivationConditionsEvaluationResults = (HumanLoopActivationOutput -> Maybe Text)
-> (HumanLoopActivationOutput
    -> Maybe Text -> HumanLoopActivationOutput)
-> Lens
     HumanLoopActivationOutput
     HumanLoopActivationOutput
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HumanLoopActivationOutput' {Maybe Text
humanLoopActivationConditionsEvaluationResults :: Maybe Text
$sel:humanLoopActivationConditionsEvaluationResults:HumanLoopActivationOutput' :: HumanLoopActivationOutput -> Maybe Text
humanLoopActivationConditionsEvaluationResults} -> Maybe Text
humanLoopActivationConditionsEvaluationResults) (\s :: HumanLoopActivationOutput
s@HumanLoopActivationOutput' {} Maybe Text
a -> HumanLoopActivationOutput
s {$sel:humanLoopActivationConditionsEvaluationResults:HumanLoopActivationOutput' :: Maybe Text
humanLoopActivationConditionsEvaluationResults = Maybe Text
a} :: HumanLoopActivationOutput)

instance Core.FromJSON HumanLoopActivationOutput where
  parseJSON :: Value -> Parser HumanLoopActivationOutput
parseJSON =
    String
-> (Object -> Parser HumanLoopActivationOutput)
-> Value
-> Parser HumanLoopActivationOutput
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"HumanLoopActivationOutput"
      ( \Object
x ->
          Maybe (NonEmpty Text)
-> Maybe Text -> Maybe Text -> HumanLoopActivationOutput
HumanLoopActivationOutput'
            (Maybe (NonEmpty Text)
 -> Maybe Text -> Maybe Text -> HumanLoopActivationOutput)
-> Parser (Maybe (NonEmpty Text))
-> Parser (Maybe Text -> Maybe Text -> HumanLoopActivationOutput)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (NonEmpty Text))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"HumanLoopActivationReasons")
            Parser (Maybe Text -> Maybe Text -> HumanLoopActivationOutput)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> HumanLoopActivationOutput)
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
"HumanLoopArn")
            Parser (Maybe Text -> HumanLoopActivationOutput)
-> Parser (Maybe Text) -> Parser HumanLoopActivationOutput
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
"HumanLoopActivationConditionsEvaluationResults"
                        )
      )

instance Prelude.Hashable HumanLoopActivationOutput

instance Prelude.NFData HumanLoopActivationOutput