{-# 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.Choice
-- 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.Choice 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.AdditionalResources
import Amazonka.WellArchitected.Types.ChoiceContent

-- | A choice available to answer question.
--
-- /See:/ 'newChoice' smart constructor.
data Choice = Choice'
  { -- | The additional resources for a choice. A choice can have up to two
    -- additional resources: one of type @HELPFUL_RESOURCE@, one of type
    -- @IMPROVEMENT_PLAN@, or both.
    Choice -> Maybe [AdditionalResources]
additionalResources :: Prelude.Maybe [AdditionalResources],
    Choice -> Maybe Text
choiceId :: Prelude.Maybe Prelude.Text,
    Choice -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The choice level helpful resource.
    Choice -> Maybe ChoiceContent
helpfulResource :: Prelude.Maybe ChoiceContent,
    -- | The choice level improvement plan.
    Choice -> Maybe ChoiceContent
improvementPlan :: Prelude.Maybe ChoiceContent,
    Choice -> Maybe Text
title :: Prelude.Maybe Prelude.Text
  }
  deriving (Choice -> Choice -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Choice -> Choice -> Bool
$c/= :: Choice -> Choice -> Bool
== :: Choice -> Choice -> Bool
$c== :: Choice -> Choice -> Bool
Prelude.Eq, ReadPrec [Choice]
ReadPrec Choice
Int -> ReadS Choice
ReadS [Choice]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Choice]
$creadListPrec :: ReadPrec [Choice]
readPrec :: ReadPrec Choice
$creadPrec :: ReadPrec Choice
readList :: ReadS [Choice]
$creadList :: ReadS [Choice]
readsPrec :: Int -> ReadS Choice
$creadsPrec :: Int -> ReadS Choice
Prelude.Read, Int -> Choice -> ShowS
[Choice] -> ShowS
Choice -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Choice] -> ShowS
$cshowList :: [Choice] -> ShowS
show :: Choice -> String
$cshow :: Choice -> String
showsPrec :: Int -> Choice -> ShowS
$cshowsPrec :: Int -> Choice -> ShowS
Prelude.Show, forall x. Rep Choice x -> Choice
forall x. Choice -> Rep Choice x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Choice x -> Choice
$cfrom :: forall x. Choice -> Rep Choice x
Prelude.Generic)

-- |
-- Create a value of 'Choice' 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:
--
-- 'additionalResources', 'choice_additionalResources' - The additional resources for a choice. A choice can have up to two
-- additional resources: one of type @HELPFUL_RESOURCE@, one of type
-- @IMPROVEMENT_PLAN@, or both.
--
-- 'choiceId', 'choice_choiceId' - Undocumented member.
--
-- 'description', 'choice_description' - Undocumented member.
--
-- 'helpfulResource', 'choice_helpfulResource' - The choice level helpful resource.
--
-- 'improvementPlan', 'choice_improvementPlan' - The choice level improvement plan.
--
-- 'title', 'choice_title' - Undocumented member.
newChoice ::
  Choice
newChoice :: Choice
newChoice =
  Choice'
    { $sel:additionalResources:Choice' :: Maybe [AdditionalResources]
additionalResources = forall a. Maybe a
Prelude.Nothing,
      $sel:choiceId:Choice' :: Maybe Text
choiceId = forall a. Maybe a
Prelude.Nothing,
      $sel:description:Choice' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:helpfulResource:Choice' :: Maybe ChoiceContent
helpfulResource = forall a. Maybe a
Prelude.Nothing,
      $sel:improvementPlan:Choice' :: Maybe ChoiceContent
improvementPlan = forall a. Maybe a
Prelude.Nothing,
      $sel:title:Choice' :: Maybe Text
title = forall a. Maybe a
Prelude.Nothing
    }

-- | The additional resources for a choice. A choice can have up to two
-- additional resources: one of type @HELPFUL_RESOURCE@, one of type
-- @IMPROVEMENT_PLAN@, or both.
choice_additionalResources :: Lens.Lens' Choice (Prelude.Maybe [AdditionalResources])
choice_additionalResources :: Lens' Choice (Maybe [AdditionalResources])
choice_additionalResources = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Choice' {Maybe [AdditionalResources]
additionalResources :: Maybe [AdditionalResources]
$sel:additionalResources:Choice' :: Choice -> Maybe [AdditionalResources]
additionalResources} -> Maybe [AdditionalResources]
additionalResources) (\s :: Choice
s@Choice' {} Maybe [AdditionalResources]
a -> Choice
s {$sel:additionalResources:Choice' :: Maybe [AdditionalResources]
additionalResources = Maybe [AdditionalResources]
a} :: Choice) 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.
choice_choiceId :: Lens.Lens' Choice (Prelude.Maybe Prelude.Text)
choice_choiceId :: Lens' Choice (Maybe Text)
choice_choiceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Choice' {Maybe Text
choiceId :: Maybe Text
$sel:choiceId:Choice' :: Choice -> Maybe Text
choiceId} -> Maybe Text
choiceId) (\s :: Choice
s@Choice' {} Maybe Text
a -> Choice
s {$sel:choiceId:Choice' :: Maybe Text
choiceId = Maybe Text
a} :: Choice)

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

-- | The choice level helpful resource.
choice_helpfulResource :: Lens.Lens' Choice (Prelude.Maybe ChoiceContent)
choice_helpfulResource :: Lens' Choice (Maybe ChoiceContent)
choice_helpfulResource = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Choice' {Maybe ChoiceContent
helpfulResource :: Maybe ChoiceContent
$sel:helpfulResource:Choice' :: Choice -> Maybe ChoiceContent
helpfulResource} -> Maybe ChoiceContent
helpfulResource) (\s :: Choice
s@Choice' {} Maybe ChoiceContent
a -> Choice
s {$sel:helpfulResource:Choice' :: Maybe ChoiceContent
helpfulResource = Maybe ChoiceContent
a} :: Choice)

-- | The choice level improvement plan.
choice_improvementPlan :: Lens.Lens' Choice (Prelude.Maybe ChoiceContent)
choice_improvementPlan :: Lens' Choice (Maybe ChoiceContent)
choice_improvementPlan = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Choice' {Maybe ChoiceContent
improvementPlan :: Maybe ChoiceContent
$sel:improvementPlan:Choice' :: Choice -> Maybe ChoiceContent
improvementPlan} -> Maybe ChoiceContent
improvementPlan) (\s :: Choice
s@Choice' {} Maybe ChoiceContent
a -> Choice
s {$sel:improvementPlan:Choice' :: Maybe ChoiceContent
improvementPlan = Maybe ChoiceContent
a} :: Choice)

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

instance Data.FromJSON Choice where
  parseJSON :: Value -> Parser Choice
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Choice"
      ( \Object
x ->
          Maybe [AdditionalResources]
-> Maybe Text
-> Maybe Text
-> Maybe ChoiceContent
-> Maybe ChoiceContent
-> Maybe Text
-> Choice
Choice'
            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
"AdditionalResources"
                            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
"ChoiceId")
            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
"Description")
            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
"HelpfulResource")
            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
"ImprovementPlan")
            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
"Title")
      )

instance Prelude.Hashable Choice where
  hashWithSalt :: Int -> Choice -> Int
hashWithSalt Int
_salt Choice' {Maybe [AdditionalResources]
Maybe Text
Maybe ChoiceContent
title :: Maybe Text
improvementPlan :: Maybe ChoiceContent
helpfulResource :: Maybe ChoiceContent
description :: Maybe Text
choiceId :: Maybe Text
additionalResources :: Maybe [AdditionalResources]
$sel:title:Choice' :: Choice -> Maybe Text
$sel:improvementPlan:Choice' :: Choice -> Maybe ChoiceContent
$sel:helpfulResource:Choice' :: Choice -> Maybe ChoiceContent
$sel:description:Choice' :: Choice -> Maybe Text
$sel:choiceId:Choice' :: Choice -> Maybe Text
$sel:additionalResources:Choice' :: Choice -> Maybe [AdditionalResources]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [AdditionalResources]
additionalResources
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
choiceId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ChoiceContent
helpfulResource
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ChoiceContent
improvementPlan
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
title

instance Prelude.NFData Choice where
  rnf :: Choice -> ()
rnf Choice' {Maybe [AdditionalResources]
Maybe Text
Maybe ChoiceContent
title :: Maybe Text
improvementPlan :: Maybe ChoiceContent
helpfulResource :: Maybe ChoiceContent
description :: Maybe Text
choiceId :: Maybe Text
additionalResources :: Maybe [AdditionalResources]
$sel:title:Choice' :: Choice -> Maybe Text
$sel:improvementPlan:Choice' :: Choice -> Maybe ChoiceContent
$sel:helpfulResource:Choice' :: Choice -> Maybe ChoiceContent
$sel:description:Choice' :: Choice -> Maybe Text
$sel:choiceId:Choice' :: Choice -> Maybe Text
$sel:additionalResources:Choice' :: Choice -> Maybe [AdditionalResources]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [AdditionalResources]
additionalResources
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
choiceId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ChoiceContent
helpfulResource
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ChoiceContent
improvementPlan
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
title