{-# 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-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.ChoiceUpdate 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.ChoiceReason
import Amazonka.WellArchitected.Types.ChoiceStatus

-- | A list of choices to be updated.
--
-- /See:/ 'newChoiceUpdate' smart constructor.
data ChoiceUpdate = ChoiceUpdate'
  { -- | The notes associated with a choice.
    ChoiceUpdate -> Maybe Text
notes :: Prelude.Maybe Prelude.Text,
    -- | The reason why a choice is non-applicable to a question in your
    -- workload.
    ChoiceUpdate -> Maybe ChoiceReason
reason :: Prelude.Maybe ChoiceReason,
    -- | The status of a choice.
    ChoiceUpdate -> ChoiceStatus
status :: ChoiceStatus
  }
  deriving (ChoiceUpdate -> ChoiceUpdate -> Bool
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]
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
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. 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:
--
-- 'notes', 'choiceUpdate_notes' - The notes associated with a choice.
--
-- 'reason', 'choiceUpdate_reason' - The reason why a choice is non-applicable to a question in your
-- workload.
--
-- 'status', 'choiceUpdate_status' - The status of a choice.
newChoiceUpdate ::
  -- | 'status'
  ChoiceStatus ->
  ChoiceUpdate
newChoiceUpdate :: ChoiceStatus -> ChoiceUpdate
newChoiceUpdate ChoiceStatus
pStatus_ =
  ChoiceUpdate'
    { $sel:notes:ChoiceUpdate' :: Maybe Text
notes = forall a. Maybe a
Prelude.Nothing,
      $sel:reason:ChoiceUpdate' :: Maybe ChoiceReason
reason = forall a. Maybe a
Prelude.Nothing,
      $sel:status:ChoiceUpdate' :: ChoiceStatus
status = ChoiceStatus
pStatus_
    }

-- | The notes associated with a choice.
choiceUpdate_notes :: Lens.Lens' ChoiceUpdate (Prelude.Maybe Prelude.Text)
choiceUpdate_notes :: Lens' ChoiceUpdate (Maybe Text)
choiceUpdate_notes = 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 reason why a choice is non-applicable to a question in your
-- workload.
choiceUpdate_reason :: Lens.Lens' ChoiceUpdate (Prelude.Maybe ChoiceReason)
choiceUpdate_reason :: Lens' ChoiceUpdate (Maybe ChoiceReason)
choiceUpdate_reason = 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 status of a choice.
choiceUpdate_status :: Lens.Lens' ChoiceUpdate ChoiceStatus
choiceUpdate_status :: Lens' ChoiceUpdate ChoiceStatus
choiceUpdate_status = 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 where
  hashWithSalt :: Int -> ChoiceUpdate -> Int
hashWithSalt Int
_salt ChoiceUpdate' {Maybe Text
Maybe ChoiceReason
ChoiceStatus
status :: ChoiceStatus
reason :: Maybe ChoiceReason
notes :: Maybe Text
$sel:status:ChoiceUpdate' :: ChoiceUpdate -> ChoiceStatus
$sel:reason:ChoiceUpdate' :: ChoiceUpdate -> Maybe ChoiceReason
$sel:notes:ChoiceUpdate' :: ChoiceUpdate -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
notes
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ChoiceReason
reason
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ChoiceStatus
status

instance Prelude.NFData ChoiceUpdate where
  rnf :: ChoiceUpdate -> ()
rnf ChoiceUpdate' {Maybe Text
Maybe ChoiceReason
ChoiceStatus
status :: ChoiceStatus
reason :: Maybe ChoiceReason
notes :: Maybe Text
$sel:status:ChoiceUpdate' :: ChoiceUpdate -> ChoiceStatus
$sel:reason:ChoiceUpdate' :: ChoiceUpdate -> Maybe ChoiceReason
$sel:notes:ChoiceUpdate' :: ChoiceUpdate -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
notes
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ChoiceReason
reason
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ChoiceStatus
status

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