{-# 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.QuickSight.Types.CustomNarrativeOptions
-- 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.QuickSight.Types.CustomNarrativeOptions 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 custom narrative options.
--
-- /See:/ 'newCustomNarrativeOptions' smart constructor.
data CustomNarrativeOptions = CustomNarrativeOptions'
  { -- | The string input of custom narrative.
    CustomNarrativeOptions -> Text
narrative :: Prelude.Text
  }
  deriving (CustomNarrativeOptions -> CustomNarrativeOptions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CustomNarrativeOptions -> CustomNarrativeOptions -> Bool
$c/= :: CustomNarrativeOptions -> CustomNarrativeOptions -> Bool
== :: CustomNarrativeOptions -> CustomNarrativeOptions -> Bool
$c== :: CustomNarrativeOptions -> CustomNarrativeOptions -> Bool
Prelude.Eq, ReadPrec [CustomNarrativeOptions]
ReadPrec CustomNarrativeOptions
Int -> ReadS CustomNarrativeOptions
ReadS [CustomNarrativeOptions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CustomNarrativeOptions]
$creadListPrec :: ReadPrec [CustomNarrativeOptions]
readPrec :: ReadPrec CustomNarrativeOptions
$creadPrec :: ReadPrec CustomNarrativeOptions
readList :: ReadS [CustomNarrativeOptions]
$creadList :: ReadS [CustomNarrativeOptions]
readsPrec :: Int -> ReadS CustomNarrativeOptions
$creadsPrec :: Int -> ReadS CustomNarrativeOptions
Prelude.Read, Int -> CustomNarrativeOptions -> ShowS
[CustomNarrativeOptions] -> ShowS
CustomNarrativeOptions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CustomNarrativeOptions] -> ShowS
$cshowList :: [CustomNarrativeOptions] -> ShowS
show :: CustomNarrativeOptions -> String
$cshow :: CustomNarrativeOptions -> String
showsPrec :: Int -> CustomNarrativeOptions -> ShowS
$cshowsPrec :: Int -> CustomNarrativeOptions -> ShowS
Prelude.Show, forall x. Rep CustomNarrativeOptions x -> CustomNarrativeOptions
forall x. CustomNarrativeOptions -> Rep CustomNarrativeOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CustomNarrativeOptions x -> CustomNarrativeOptions
$cfrom :: forall x. CustomNarrativeOptions -> Rep CustomNarrativeOptions x
Prelude.Generic)

-- |
-- Create a value of 'CustomNarrativeOptions' 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:
--
-- 'narrative', 'customNarrativeOptions_narrative' - The string input of custom narrative.
newCustomNarrativeOptions ::
  -- | 'narrative'
  Prelude.Text ->
  CustomNarrativeOptions
newCustomNarrativeOptions :: Text -> CustomNarrativeOptions
newCustomNarrativeOptions Text
pNarrative_ =
  CustomNarrativeOptions' {$sel:narrative:CustomNarrativeOptions' :: Text
narrative = Text
pNarrative_}

-- | The string input of custom narrative.
customNarrativeOptions_narrative :: Lens.Lens' CustomNarrativeOptions Prelude.Text
customNarrativeOptions_narrative :: Lens' CustomNarrativeOptions Text
customNarrativeOptions_narrative = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomNarrativeOptions' {Text
narrative :: Text
$sel:narrative:CustomNarrativeOptions' :: CustomNarrativeOptions -> Text
narrative} -> Text
narrative) (\s :: CustomNarrativeOptions
s@CustomNarrativeOptions' {} Text
a -> CustomNarrativeOptions
s {$sel:narrative:CustomNarrativeOptions' :: Text
narrative = Text
a} :: CustomNarrativeOptions)

instance Data.FromJSON CustomNarrativeOptions where
  parseJSON :: Value -> Parser CustomNarrativeOptions
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"CustomNarrativeOptions"
      ( \Object
x ->
          Text -> CustomNarrativeOptions
CustomNarrativeOptions'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Narrative")
      )

instance Prelude.Hashable CustomNarrativeOptions where
  hashWithSalt :: Int -> CustomNarrativeOptions -> Int
hashWithSalt Int
_salt CustomNarrativeOptions' {Text
narrative :: Text
$sel:narrative:CustomNarrativeOptions' :: CustomNarrativeOptions -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
narrative

instance Prelude.NFData CustomNarrativeOptions where
  rnf :: CustomNarrativeOptions -> ()
rnf CustomNarrativeOptions' {Text
narrative :: Text
$sel:narrative:CustomNarrativeOptions' :: CustomNarrativeOptions -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
narrative

instance Data.ToJSON CustomNarrativeOptions where
  toJSON :: CustomNarrativeOptions -> Value
toJSON CustomNarrativeOptions' {Text
narrative :: Text
$sel:narrative:CustomNarrativeOptions' :: CustomNarrativeOptions -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"Narrative" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
narrative)]
      )