{-# 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.ChoiceContent
-- 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.ChoiceContent 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

-- | The choice content.
--
-- /See:/ 'newChoiceContent' smart constructor.
data ChoiceContent = ChoiceContent'
  { -- | The display text for the choice content.
    ChoiceContent -> Maybe Text
displayText :: Prelude.Maybe Prelude.Text,
    -- | The URL for the choice content.
    ChoiceContent -> Maybe Text
url :: Prelude.Maybe Prelude.Text
  }
  deriving (ChoiceContent -> ChoiceContent -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ChoiceContent -> ChoiceContent -> Bool
$c/= :: ChoiceContent -> ChoiceContent -> Bool
== :: ChoiceContent -> ChoiceContent -> Bool
$c== :: ChoiceContent -> ChoiceContent -> Bool
Prelude.Eq, ReadPrec [ChoiceContent]
ReadPrec ChoiceContent
Int -> ReadS ChoiceContent
ReadS [ChoiceContent]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ChoiceContent]
$creadListPrec :: ReadPrec [ChoiceContent]
readPrec :: ReadPrec ChoiceContent
$creadPrec :: ReadPrec ChoiceContent
readList :: ReadS [ChoiceContent]
$creadList :: ReadS [ChoiceContent]
readsPrec :: Int -> ReadS ChoiceContent
$creadsPrec :: Int -> ReadS ChoiceContent
Prelude.Read, Int -> ChoiceContent -> ShowS
[ChoiceContent] -> ShowS
ChoiceContent -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ChoiceContent] -> ShowS
$cshowList :: [ChoiceContent] -> ShowS
show :: ChoiceContent -> String
$cshow :: ChoiceContent -> String
showsPrec :: Int -> ChoiceContent -> ShowS
$cshowsPrec :: Int -> ChoiceContent -> ShowS
Prelude.Show, forall x. Rep ChoiceContent x -> ChoiceContent
forall x. ChoiceContent -> Rep ChoiceContent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ChoiceContent x -> ChoiceContent
$cfrom :: forall x. ChoiceContent -> Rep ChoiceContent x
Prelude.Generic)

-- |
-- Create a value of 'ChoiceContent' 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:
--
-- 'displayText', 'choiceContent_displayText' - The display text for the choice content.
--
-- 'url', 'choiceContent_url' - The URL for the choice content.
newChoiceContent ::
  ChoiceContent
newChoiceContent :: ChoiceContent
newChoiceContent =
  ChoiceContent'
    { $sel:displayText:ChoiceContent' :: Maybe Text
displayText = forall a. Maybe a
Prelude.Nothing,
      $sel:url:ChoiceContent' :: Maybe Text
url = forall a. Maybe a
Prelude.Nothing
    }

-- | The display text for the choice content.
choiceContent_displayText :: Lens.Lens' ChoiceContent (Prelude.Maybe Prelude.Text)
choiceContent_displayText :: Lens' ChoiceContent (Maybe Text)
choiceContent_displayText = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChoiceContent' {Maybe Text
displayText :: Maybe Text
$sel:displayText:ChoiceContent' :: ChoiceContent -> Maybe Text
displayText} -> Maybe Text
displayText) (\s :: ChoiceContent
s@ChoiceContent' {} Maybe Text
a -> ChoiceContent
s {$sel:displayText:ChoiceContent' :: Maybe Text
displayText = Maybe Text
a} :: ChoiceContent)

-- | The URL for the choice content.
choiceContent_url :: Lens.Lens' ChoiceContent (Prelude.Maybe Prelude.Text)
choiceContent_url :: Lens' ChoiceContent (Maybe Text)
choiceContent_url = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChoiceContent' {Maybe Text
url :: Maybe Text
$sel:url:ChoiceContent' :: ChoiceContent -> Maybe Text
url} -> Maybe Text
url) (\s :: ChoiceContent
s@ChoiceContent' {} Maybe Text
a -> ChoiceContent
s {$sel:url:ChoiceContent' :: Maybe Text
url = Maybe Text
a} :: ChoiceContent)

instance Data.FromJSON ChoiceContent where
  parseJSON :: Value -> Parser ChoiceContent
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ChoiceContent"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> ChoiceContent
ChoiceContent'
            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
"DisplayText")
            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
"Url")
      )

instance Prelude.Hashable ChoiceContent where
  hashWithSalt :: Int -> ChoiceContent -> Int
hashWithSalt Int
_salt ChoiceContent' {Maybe Text
url :: Maybe Text
displayText :: Maybe Text
$sel:url:ChoiceContent' :: ChoiceContent -> Maybe Text
$sel:displayText:ChoiceContent' :: ChoiceContent -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
displayText
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
url

instance Prelude.NFData ChoiceContent where
  rnf :: ChoiceContent -> ()
rnf ChoiceContent' {Maybe Text
url :: Maybe Text
displayText :: Maybe Text
$sel:url:ChoiceContent' :: ChoiceContent -> Maybe Text
$sel:displayText:ChoiceContent' :: ChoiceContent -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
displayText
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
url