{-# 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-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.Choice where

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

-- | A choice available to answer question.
--
-- /See:/ 'newChoice' smart constructor.
data Choice = Choice'
  { Choice -> Maybe Text
title :: Prelude.Maybe Prelude.Text,
    Choice -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    Choice -> Maybe Text
choiceId :: Prelude.Maybe Prelude.Text
  }
  deriving (Choice -> Choice -> Bool
(Choice -> Choice -> Bool)
-> (Choice -> Choice -> Bool) -> Eq Choice
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]
(Int -> ReadS Choice)
-> ReadS [Choice]
-> ReadPrec Choice
-> ReadPrec [Choice]
-> Read 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
(Int -> Choice -> ShowS)
-> (Choice -> String) -> ([Choice] -> ShowS) -> Show Choice
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. Choice -> Rep Choice x)
-> (forall x. Rep Choice x -> Choice) -> Generic Choice
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:
--
-- 'title', 'choice_title' - Undocumented member.
--
-- 'description', 'choice_description' - Undocumented member.
--
-- 'choiceId', 'choice_choiceId' - Undocumented member.
newChoice ::
  Choice
newChoice :: Choice
newChoice =
  Choice' :: Maybe Text -> Maybe Text -> Maybe Text -> Choice
Choice'
    { $sel:title:Choice' :: Maybe Text
title = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:Choice' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:choiceId:Choice' :: Maybe Text
choiceId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Undocumented member.
choice_title :: Lens.Lens' Choice (Prelude.Maybe Prelude.Text)
choice_title :: (Maybe Text -> f (Maybe Text)) -> Choice -> f Choice
choice_title = (Choice -> Maybe Text)
-> (Choice -> Maybe Text -> Choice)
-> Lens Choice Choice (Maybe Text) (Maybe Text)
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)

-- | Undocumented member.
choice_description :: Lens.Lens' Choice (Prelude.Maybe Prelude.Text)
choice_description :: (Maybe Text -> f (Maybe Text)) -> Choice -> f Choice
choice_description = (Choice -> Maybe Text)
-> (Choice -> Maybe Text -> Choice)
-> Lens Choice Choice (Maybe Text) (Maybe Text)
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)

-- | Undocumented member.
choice_choiceId :: Lens.Lens' Choice (Prelude.Maybe Prelude.Text)
choice_choiceId :: (Maybe Text -> f (Maybe Text)) -> Choice -> f Choice
choice_choiceId = (Choice -> Maybe Text)
-> (Choice -> Maybe Text -> Choice)
-> Lens Choice Choice (Maybe Text) (Maybe Text)
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)

instance Core.FromJSON Choice where
  parseJSON :: Value -> Parser Choice
parseJSON =
    String -> (Object -> Parser Choice) -> Value -> Parser Choice
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Choice"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Maybe Text -> Choice
Choice'
            (Maybe Text -> Maybe Text -> Maybe Text -> Choice)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> Choice)
forall (f :: * -> *) a b. Functor 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
"Title")
            Parser (Maybe Text -> Maybe Text -> Choice)
-> Parser (Maybe Text) -> Parser (Maybe Text -> Choice)
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
"Description")
            Parser (Maybe Text -> Choice)
-> Parser (Maybe Text) -> Parser Choice
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
"ChoiceId")
      )

instance Prelude.Hashable Choice

instance Prelude.NFData Choice