{-# 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.WellArchitected.Types.AnswerSummary
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.WellArchitected.Types.AnswerSummary where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import Amazonka.WellArchitected.Types.AnswerReason
import Amazonka.WellArchitected.Types.Choice
import Amazonka.WellArchitected.Types.ChoiceAnswerSummary
import Amazonka.WellArchitected.Types.Risk

-- | An answer summary of a lens review in a workload.
--
-- /See:/ 'newAnswerSummary' smart constructor.
data AnswerSummary = AnswerSummary'
  { -- | A list of selected choices to a question in your workload.
    AnswerSummary -> Maybe [ChoiceAnswerSummary]
choiceAnswerSummaries :: Prelude.Maybe [ChoiceAnswerSummary],
    AnswerSummary -> Maybe [Choice]
choices :: Prelude.Maybe [Choice],
    AnswerSummary -> Maybe Bool
isApplicable :: Prelude.Maybe Prelude.Bool,
    AnswerSummary -> Maybe Text
pillarId :: Prelude.Maybe Prelude.Text,
    AnswerSummary -> Maybe Text
questionId :: Prelude.Maybe Prelude.Text,
    AnswerSummary -> Maybe Text
questionTitle :: Prelude.Maybe Prelude.Text,
    -- | The reason why a choice is non-applicable to a question in your
    -- workload.
    AnswerSummary -> Maybe AnswerReason
reason :: Prelude.Maybe AnswerReason,
    AnswerSummary -> Maybe Risk
risk :: Prelude.Maybe Risk,
    AnswerSummary -> Maybe [Text]
selectedChoices :: Prelude.Maybe [Prelude.Text]
  }
  deriving (AnswerSummary -> AnswerSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AnswerSummary -> AnswerSummary -> Bool
$c/= :: AnswerSummary -> AnswerSummary -> Bool
== :: AnswerSummary -> AnswerSummary -> Bool
$c== :: AnswerSummary -> AnswerSummary -> Bool
Prelude.Eq, ReadPrec [AnswerSummary]
ReadPrec AnswerSummary
Int -> ReadS AnswerSummary
ReadS [AnswerSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AnswerSummary]
$creadListPrec :: ReadPrec [AnswerSummary]
readPrec :: ReadPrec AnswerSummary
$creadPrec :: ReadPrec AnswerSummary
readList :: ReadS [AnswerSummary]
$creadList :: ReadS [AnswerSummary]
readsPrec :: Int -> ReadS AnswerSummary
$creadsPrec :: Int -> ReadS AnswerSummary
Prelude.Read, Int -> AnswerSummary -> ShowS
[AnswerSummary] -> ShowS
AnswerSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AnswerSummary] -> ShowS
$cshowList :: [AnswerSummary] -> ShowS
show :: AnswerSummary -> String
$cshow :: AnswerSummary -> String
showsPrec :: Int -> AnswerSummary -> ShowS
$cshowsPrec :: Int -> AnswerSummary -> ShowS
Prelude.Show, forall x. Rep AnswerSummary x -> AnswerSummary
forall x. AnswerSummary -> Rep AnswerSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AnswerSummary x -> AnswerSummary
$cfrom :: forall x. AnswerSummary -> Rep AnswerSummary x
Prelude.Generic)

-- |
-- Create a value of 'AnswerSummary' 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:
--
-- 'choiceAnswerSummaries', 'answerSummary_choiceAnswerSummaries' - A list of selected choices to a question in your workload.
--
-- 'choices', 'answerSummary_choices' - Undocumented member.
--
-- 'isApplicable', 'answerSummary_isApplicable' - Undocumented member.
--
-- 'pillarId', 'answerSummary_pillarId' - Undocumented member.
--
-- 'questionId', 'answerSummary_questionId' - Undocumented member.
--
-- 'questionTitle', 'answerSummary_questionTitle' - Undocumented member.
--
-- 'reason', 'answerSummary_reason' - The reason why a choice is non-applicable to a question in your
-- workload.
--
-- 'risk', 'answerSummary_risk' - Undocumented member.
--
-- 'selectedChoices', 'answerSummary_selectedChoices' - Undocumented member.
newAnswerSummary ::
  AnswerSummary
newAnswerSummary :: AnswerSummary
newAnswerSummary =
  AnswerSummary'
    { $sel:choiceAnswerSummaries:AnswerSummary' :: Maybe [ChoiceAnswerSummary]
choiceAnswerSummaries =
        forall a. Maybe a
Prelude.Nothing,
      $sel:choices:AnswerSummary' :: Maybe [Choice]
choices = forall a. Maybe a
Prelude.Nothing,
      $sel:isApplicable:AnswerSummary' :: Maybe Bool
isApplicable = forall a. Maybe a
Prelude.Nothing,
      $sel:pillarId:AnswerSummary' :: Maybe Text
pillarId = forall a. Maybe a
Prelude.Nothing,
      $sel:questionId:AnswerSummary' :: Maybe Text
questionId = forall a. Maybe a
Prelude.Nothing,
      $sel:questionTitle:AnswerSummary' :: Maybe Text
questionTitle = forall a. Maybe a
Prelude.Nothing,
      $sel:reason:AnswerSummary' :: Maybe AnswerReason
reason = forall a. Maybe a
Prelude.Nothing,
      $sel:risk:AnswerSummary' :: Maybe Risk
risk = forall a. Maybe a
Prelude.Nothing,
      $sel:selectedChoices:AnswerSummary' :: Maybe [Text]
selectedChoices = forall a. Maybe a
Prelude.Nothing
    }

-- | A list of selected choices to a question in your workload.
answerSummary_choiceAnswerSummaries :: Lens.Lens' AnswerSummary (Prelude.Maybe [ChoiceAnswerSummary])
answerSummary_choiceAnswerSummaries :: Lens' AnswerSummary (Maybe [ChoiceAnswerSummary])
answerSummary_choiceAnswerSummaries = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnswerSummary' {Maybe [ChoiceAnswerSummary]
choiceAnswerSummaries :: Maybe [ChoiceAnswerSummary]
$sel:choiceAnswerSummaries:AnswerSummary' :: AnswerSummary -> Maybe [ChoiceAnswerSummary]
choiceAnswerSummaries} -> Maybe [ChoiceAnswerSummary]
choiceAnswerSummaries) (\s :: AnswerSummary
s@AnswerSummary' {} Maybe [ChoiceAnswerSummary]
a -> AnswerSummary
s {$sel:choiceAnswerSummaries:AnswerSummary' :: Maybe [ChoiceAnswerSummary]
choiceAnswerSummaries = Maybe [ChoiceAnswerSummary]
a} :: AnswerSummary) 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

-- | Undocumented member.
answerSummary_choices :: Lens.Lens' AnswerSummary (Prelude.Maybe [Choice])
answerSummary_choices :: Lens' AnswerSummary (Maybe [Choice])
answerSummary_choices = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnswerSummary' {Maybe [Choice]
choices :: Maybe [Choice]
$sel:choices:AnswerSummary' :: AnswerSummary -> Maybe [Choice]
choices} -> Maybe [Choice]
choices) (\s :: AnswerSummary
s@AnswerSummary' {} Maybe [Choice]
a -> AnswerSummary
s {$sel:choices:AnswerSummary' :: Maybe [Choice]
choices = Maybe [Choice]
a} :: AnswerSummary) 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

-- | Undocumented member.
answerSummary_isApplicable :: Lens.Lens' AnswerSummary (Prelude.Maybe Prelude.Bool)
answerSummary_isApplicable :: Lens' AnswerSummary (Maybe Bool)
answerSummary_isApplicable = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnswerSummary' {Maybe Bool
isApplicable :: Maybe Bool
$sel:isApplicable:AnswerSummary' :: AnswerSummary -> Maybe Bool
isApplicable} -> Maybe Bool
isApplicable) (\s :: AnswerSummary
s@AnswerSummary' {} Maybe Bool
a -> AnswerSummary
s {$sel:isApplicable:AnswerSummary' :: Maybe Bool
isApplicable = Maybe Bool
a} :: AnswerSummary)

-- | Undocumented member.
answerSummary_pillarId :: Lens.Lens' AnswerSummary (Prelude.Maybe Prelude.Text)
answerSummary_pillarId :: Lens' AnswerSummary (Maybe Text)
answerSummary_pillarId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnswerSummary' {Maybe Text
pillarId :: Maybe Text
$sel:pillarId:AnswerSummary' :: AnswerSummary -> Maybe Text
pillarId} -> Maybe Text
pillarId) (\s :: AnswerSummary
s@AnswerSummary' {} Maybe Text
a -> AnswerSummary
s {$sel:pillarId:AnswerSummary' :: Maybe Text
pillarId = Maybe Text
a} :: AnswerSummary)

-- | Undocumented member.
answerSummary_questionId :: Lens.Lens' AnswerSummary (Prelude.Maybe Prelude.Text)
answerSummary_questionId :: Lens' AnswerSummary (Maybe Text)
answerSummary_questionId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnswerSummary' {Maybe Text
questionId :: Maybe Text
$sel:questionId:AnswerSummary' :: AnswerSummary -> Maybe Text
questionId} -> Maybe Text
questionId) (\s :: AnswerSummary
s@AnswerSummary' {} Maybe Text
a -> AnswerSummary
s {$sel:questionId:AnswerSummary' :: Maybe Text
questionId = Maybe Text
a} :: AnswerSummary)

-- | Undocumented member.
answerSummary_questionTitle :: Lens.Lens' AnswerSummary (Prelude.Maybe Prelude.Text)
answerSummary_questionTitle :: Lens' AnswerSummary (Maybe Text)
answerSummary_questionTitle = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnswerSummary' {Maybe Text
questionTitle :: Maybe Text
$sel:questionTitle:AnswerSummary' :: AnswerSummary -> Maybe Text
questionTitle} -> Maybe Text
questionTitle) (\s :: AnswerSummary
s@AnswerSummary' {} Maybe Text
a -> AnswerSummary
s {$sel:questionTitle:AnswerSummary' :: Maybe Text
questionTitle = Maybe Text
a} :: AnswerSummary)

-- | The reason why a choice is non-applicable to a question in your
-- workload.
answerSummary_reason :: Lens.Lens' AnswerSummary (Prelude.Maybe AnswerReason)
answerSummary_reason :: Lens' AnswerSummary (Maybe AnswerReason)
answerSummary_reason = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnswerSummary' {Maybe AnswerReason
reason :: Maybe AnswerReason
$sel:reason:AnswerSummary' :: AnswerSummary -> Maybe AnswerReason
reason} -> Maybe AnswerReason
reason) (\s :: AnswerSummary
s@AnswerSummary' {} Maybe AnswerReason
a -> AnswerSummary
s {$sel:reason:AnswerSummary' :: Maybe AnswerReason
reason = Maybe AnswerReason
a} :: AnswerSummary)

-- | Undocumented member.
answerSummary_risk :: Lens.Lens' AnswerSummary (Prelude.Maybe Risk)
answerSummary_risk :: Lens' AnswerSummary (Maybe Risk)
answerSummary_risk = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnswerSummary' {Maybe Risk
risk :: Maybe Risk
$sel:risk:AnswerSummary' :: AnswerSummary -> Maybe Risk
risk} -> Maybe Risk
risk) (\s :: AnswerSummary
s@AnswerSummary' {} Maybe Risk
a -> AnswerSummary
s {$sel:risk:AnswerSummary' :: Maybe Risk
risk = Maybe Risk
a} :: AnswerSummary)

-- | Undocumented member.
answerSummary_selectedChoices :: Lens.Lens' AnswerSummary (Prelude.Maybe [Prelude.Text])
answerSummary_selectedChoices :: Lens' AnswerSummary (Maybe [Text])
answerSummary_selectedChoices = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnswerSummary' {Maybe [Text]
selectedChoices :: Maybe [Text]
$sel:selectedChoices:AnswerSummary' :: AnswerSummary -> Maybe [Text]
selectedChoices} -> Maybe [Text]
selectedChoices) (\s :: AnswerSummary
s@AnswerSummary' {} Maybe [Text]
a -> AnswerSummary
s {$sel:selectedChoices:AnswerSummary' :: Maybe [Text]
selectedChoices = Maybe [Text]
a} :: AnswerSummary) 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

instance Data.FromJSON AnswerSummary where
  parseJSON :: Value -> Parser AnswerSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AnswerSummary"
      ( \Object
x ->
          Maybe [ChoiceAnswerSummary]
-> Maybe [Choice]
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe AnswerReason
-> Maybe Risk
-> Maybe [Text]
-> AnswerSummary
AnswerSummary'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ChoiceAnswerSummaries"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Choices" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"IsApplicable")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"PillarId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"QuestionId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"QuestionTitle")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Reason")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Risk")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"SelectedChoices"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable AnswerSummary where
  hashWithSalt :: Int -> AnswerSummary -> Int
hashWithSalt Int
_salt AnswerSummary' {Maybe Bool
Maybe [Text]
Maybe [Choice]
Maybe [ChoiceAnswerSummary]
Maybe Text
Maybe AnswerReason
Maybe Risk
selectedChoices :: Maybe [Text]
risk :: Maybe Risk
reason :: Maybe AnswerReason
questionTitle :: Maybe Text
questionId :: Maybe Text
pillarId :: Maybe Text
isApplicable :: Maybe Bool
choices :: Maybe [Choice]
choiceAnswerSummaries :: Maybe [ChoiceAnswerSummary]
$sel:selectedChoices:AnswerSummary' :: AnswerSummary -> Maybe [Text]
$sel:risk:AnswerSummary' :: AnswerSummary -> Maybe Risk
$sel:reason:AnswerSummary' :: AnswerSummary -> Maybe AnswerReason
$sel:questionTitle:AnswerSummary' :: AnswerSummary -> Maybe Text
$sel:questionId:AnswerSummary' :: AnswerSummary -> Maybe Text
$sel:pillarId:AnswerSummary' :: AnswerSummary -> Maybe Text
$sel:isApplicable:AnswerSummary' :: AnswerSummary -> Maybe Bool
$sel:choices:AnswerSummary' :: AnswerSummary -> Maybe [Choice]
$sel:choiceAnswerSummaries:AnswerSummary' :: AnswerSummary -> Maybe [ChoiceAnswerSummary]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [ChoiceAnswerSummary]
choiceAnswerSummaries
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Choice]
choices
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
isApplicable
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
pillarId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
questionId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
questionTitle
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AnswerReason
reason
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Risk
risk
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
selectedChoices

instance Prelude.NFData AnswerSummary where
  rnf :: AnswerSummary -> ()
rnf AnswerSummary' {Maybe Bool
Maybe [Text]
Maybe [Choice]
Maybe [ChoiceAnswerSummary]
Maybe Text
Maybe AnswerReason
Maybe Risk
selectedChoices :: Maybe [Text]
risk :: Maybe Risk
reason :: Maybe AnswerReason
questionTitle :: Maybe Text
questionId :: Maybe Text
pillarId :: Maybe Text
isApplicable :: Maybe Bool
choices :: Maybe [Choice]
choiceAnswerSummaries :: Maybe [ChoiceAnswerSummary]
$sel:selectedChoices:AnswerSummary' :: AnswerSummary -> Maybe [Text]
$sel:risk:AnswerSummary' :: AnswerSummary -> Maybe Risk
$sel:reason:AnswerSummary' :: AnswerSummary -> Maybe AnswerReason
$sel:questionTitle:AnswerSummary' :: AnswerSummary -> Maybe Text
$sel:questionId:AnswerSummary' :: AnswerSummary -> Maybe Text
$sel:pillarId:AnswerSummary' :: AnswerSummary -> Maybe Text
$sel:isApplicable:AnswerSummary' :: AnswerSummary -> Maybe Bool
$sel:choices:AnswerSummary' :: AnswerSummary -> Maybe [Choice]
$sel:choiceAnswerSummaries:AnswerSummary' :: AnswerSummary -> Maybe [ChoiceAnswerSummary]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [ChoiceAnswerSummary]
choiceAnswerSummaries
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Choice]
choices
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
isApplicable
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
pillarId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
questionId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
questionTitle
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe AnswerReason
reason
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Risk
risk
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
selectedChoices