{-# 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.ChoiceUpdate
-- 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.WellArchitected.Types.ChoiceUpdate where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.WellArchitected.Types.ChoiceReason
import Amazonka.WellArchitected.Types.ChoiceStatus

-- | A list of choices to be updated.
--
-- /See:/ 'newChoiceUpdate' smart constructor.
data ChoiceUpdate = ChoiceUpdate'
  { -- | The reason why a choice is non-applicable to a question in your
    -- workload.
    ChoiceUpdate -> Maybe ChoiceReason
reason :: Prelude.Maybe ChoiceReason,
    -- | The notes associated with a choice.
    ChoiceUpdate -> Maybe Text
notes :: Prelude.Maybe Prelude.Text,
    -- | The status of a choice.
    ChoiceUpdate -> ChoiceStatus
status :: ChoiceStatus
  }
  deriving (ChoiceUpdate -> ChoiceUpdate -> Bool
(ChoiceUpdate -> ChoiceUpdate -> Bool)
-> (ChoiceUpdate -> ChoiceUpdate -> Bool) -> Eq ChoiceUpdate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ChoiceUpdate -> ChoiceUpdate -> Bool
$c/= :: ChoiceUpdate -> ChoiceUpdate -> Bool
== :: ChoiceUpdate -> ChoiceUpdate -> Bool
$c== :: ChoiceUpdate -> ChoiceUpdate -> Bool
Prelude.Eq, ReadPrec [ChoiceUpdate]
ReadPrec ChoiceUpdate
Int -> ReadS ChoiceUpdate
ReadS [ChoiceUpdate]
(Int -> ReadS ChoiceUpdate)
-> ReadS [ChoiceUpdate]
-> ReadPrec ChoiceUpdate
-> ReadPrec [ChoiceUpdate]
-> Read ChoiceUpdate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ChoiceUpdate]
$creadListPrec :: ReadPrec [ChoiceUpdate]
readPrec :: ReadPrec ChoiceUpdate
$creadPrec :: ReadPrec ChoiceUpdate
readList :: ReadS [ChoiceUpdate]
$creadList :: ReadS [ChoiceUpdate]
readsPrec :: Int -> ReadS ChoiceUpdate
$creadsPrec :: Int -> ReadS ChoiceUpdate
Prelude.Read, Int -> ChoiceUpdate -> ShowS
[ChoiceUpdate] -> ShowS
ChoiceUpdate -> String
(Int -> ChoiceUpdate -> ShowS)
-> (ChoiceUpdate -> String)
-> ([ChoiceUpdate] -> ShowS)
-> Show ChoiceUpdate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ChoiceUpdate] -> ShowS
$cshowList :: [ChoiceUpdate] -> ShowS
show :: ChoiceUpdate -> String
$cshow :: ChoiceUpdate -> String
showsPrec :: Int -> ChoiceUpdate -> ShowS
$cshowsPrec :: Int -> ChoiceUpdate -> ShowS
Prelude.Show, (forall x. ChoiceUpdate -> Rep ChoiceUpdate x)
-> (forall x. Rep ChoiceUpdate x -> ChoiceUpdate)
-> Generic ChoiceUpdate
forall x. Rep ChoiceUpdate x -> ChoiceUpdate
forall x. ChoiceUpdate -> Rep ChoiceUpdate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ChoiceUpdate x -> ChoiceUpdate
$cfrom :: forall x. ChoiceUpdate -> Rep ChoiceUpdate x
Prelude.Generic)

-- |
-- Create a value of 'ChoiceUpdate' 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:
--
-- 'reason', 'choiceUpdate_reason' - The reason why a choice is non-applicable to a question in your
-- workload.
--
-- 'notes', 'choiceUpdate_notes' - The notes associated with a choice.
--
-- 'status', 'choiceUpdate_status' - The status of a choice.
newChoiceUpdate ::
  -- | 'status'
  ChoiceStatus ->
  ChoiceUpdate
newChoiceUpdate :: ChoiceStatus -> ChoiceUpdate
newChoiceUpdate ChoiceStatus
pStatus_ =
  ChoiceUpdate' :: Maybe ChoiceReason -> Maybe Text -> ChoiceStatus -> ChoiceUpdate
ChoiceUpdate'
    { $sel:reason:ChoiceUpdate' :: Maybe ChoiceReason
reason = Maybe ChoiceReason
forall a. Maybe a
Prelude.Nothing,
      $sel:notes:ChoiceUpdate' :: Maybe Text
notes = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:status:ChoiceUpdate' :: ChoiceStatus
status = ChoiceStatus
pStatus_
    }

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

-- | The notes associated with a choice.
choiceUpdate_notes :: Lens.Lens' ChoiceUpdate (Prelude.Maybe Prelude.Text)
choiceUpdate_notes :: (Maybe Text -> f (Maybe Text)) -> ChoiceUpdate -> f ChoiceUpdate
choiceUpdate_notes = (ChoiceUpdate -> Maybe Text)
-> (ChoiceUpdate -> Maybe Text -> ChoiceUpdate)
-> Lens ChoiceUpdate ChoiceUpdate (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChoiceUpdate' {Maybe Text
notes :: Maybe Text
$sel:notes:ChoiceUpdate' :: ChoiceUpdate -> Maybe Text
notes} -> Maybe Text
notes) (\s :: ChoiceUpdate
s@ChoiceUpdate' {} Maybe Text
a -> ChoiceUpdate
s {$sel:notes:ChoiceUpdate' :: Maybe Text
notes = Maybe Text
a} :: ChoiceUpdate)

-- | The status of a choice.
choiceUpdate_status :: Lens.Lens' ChoiceUpdate ChoiceStatus
choiceUpdate_status :: (ChoiceStatus -> f ChoiceStatus) -> ChoiceUpdate -> f ChoiceUpdate
choiceUpdate_status = (ChoiceUpdate -> ChoiceStatus)
-> (ChoiceUpdate -> ChoiceStatus -> ChoiceUpdate)
-> Lens ChoiceUpdate ChoiceUpdate ChoiceStatus ChoiceStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChoiceUpdate' {ChoiceStatus
status :: ChoiceStatus
$sel:status:ChoiceUpdate' :: ChoiceUpdate -> ChoiceStatus
status} -> ChoiceStatus
status) (\s :: ChoiceUpdate
s@ChoiceUpdate' {} ChoiceStatus
a -> ChoiceUpdate
s {$sel:status:ChoiceUpdate' :: ChoiceStatus
status = ChoiceStatus
a} :: ChoiceUpdate)

instance Prelude.Hashable ChoiceUpdate

instance Prelude.NFData ChoiceUpdate

instance Core.ToJSON ChoiceUpdate where
  toJSON :: ChoiceUpdate -> Value
toJSON ChoiceUpdate' {Maybe Text
Maybe ChoiceReason
ChoiceStatus
status :: ChoiceStatus
notes :: Maybe Text
reason :: Maybe ChoiceReason
$sel:status:ChoiceUpdate' :: ChoiceUpdate -> ChoiceStatus
$sel:notes:ChoiceUpdate' :: ChoiceUpdate -> Maybe Text
$sel:reason:ChoiceUpdate' :: ChoiceUpdate -> Maybe ChoiceReason
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Reason" Text -> ChoiceReason -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ChoiceReason -> Pair) -> Maybe ChoiceReason -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ChoiceReason
reason,
            (Text
"Notes" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
notes,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Status" Text -> ChoiceStatus -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ChoiceStatus
status)
          ]
      )