{-# 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.AlexaBusiness.Types.Content
-- 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.AlexaBusiness.Types.Content where

import Amazonka.AlexaBusiness.Types.Audio
import Amazonka.AlexaBusiness.Types.Ssml
import Amazonka.AlexaBusiness.Types.TextMessage
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 content definition. This can contain only one text, SSML, or audio
-- list object.
--
-- /See:/ 'newContent' smart constructor.
data Content = Content'
  { -- | The list of audio messages.
    Content -> Maybe [Audio]
audioList :: Prelude.Maybe [Audio],
    -- | The list of SSML messages.
    Content -> Maybe [Ssml]
ssmlList :: Prelude.Maybe [Ssml],
    -- | The list of text messages.
    Content -> Maybe [TextMessage]
textList :: Prelude.Maybe [TextMessage]
  }
  deriving (Content -> Content -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Content -> Content -> Bool
$c/= :: Content -> Content -> Bool
== :: Content -> Content -> Bool
$c== :: Content -> Content -> Bool
Prelude.Eq, ReadPrec [Content]
ReadPrec Content
Int -> ReadS Content
ReadS [Content]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Content]
$creadListPrec :: ReadPrec [Content]
readPrec :: ReadPrec Content
$creadPrec :: ReadPrec Content
readList :: ReadS [Content]
$creadList :: ReadS [Content]
readsPrec :: Int -> ReadS Content
$creadsPrec :: Int -> ReadS Content
Prelude.Read, Int -> Content -> ShowS
[Content] -> ShowS
Content -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Content] -> ShowS
$cshowList :: [Content] -> ShowS
show :: Content -> String
$cshow :: Content -> String
showsPrec :: Int -> Content -> ShowS
$cshowsPrec :: Int -> Content -> ShowS
Prelude.Show, forall x. Rep Content x -> Content
forall x. Content -> Rep Content x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Content x -> Content
$cfrom :: forall x. Content -> Rep Content x
Prelude.Generic)

-- |
-- Create a value of 'Content' 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:
--
-- 'audioList', 'content_audioList' - The list of audio messages.
--
-- 'ssmlList', 'content_ssmlList' - The list of SSML messages.
--
-- 'textList', 'content_textList' - The list of text messages.
newContent ::
  Content
newContent :: Content
newContent =
  Content'
    { $sel:audioList:Content' :: Maybe [Audio]
audioList = forall a. Maybe a
Prelude.Nothing,
      $sel:ssmlList:Content' :: Maybe [Ssml]
ssmlList = forall a. Maybe a
Prelude.Nothing,
      $sel:textList:Content' :: Maybe [TextMessage]
textList = forall a. Maybe a
Prelude.Nothing
    }

-- | The list of audio messages.
content_audioList :: Lens.Lens' Content (Prelude.Maybe [Audio])
content_audioList :: Lens' Content (Maybe [Audio])
content_audioList = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Content' {Maybe [Audio]
audioList :: Maybe [Audio]
$sel:audioList:Content' :: Content -> Maybe [Audio]
audioList} -> Maybe [Audio]
audioList) (\s :: Content
s@Content' {} Maybe [Audio]
a -> Content
s {$sel:audioList:Content' :: Maybe [Audio]
audioList = Maybe [Audio]
a} :: Content) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The list of SSML messages.
content_ssmlList :: Lens.Lens' Content (Prelude.Maybe [Ssml])
content_ssmlList :: Lens' Content (Maybe [Ssml])
content_ssmlList = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Content' {Maybe [Ssml]
ssmlList :: Maybe [Ssml]
$sel:ssmlList:Content' :: Content -> Maybe [Ssml]
ssmlList} -> Maybe [Ssml]
ssmlList) (\s :: Content
s@Content' {} Maybe [Ssml]
a -> Content
s {$sel:ssmlList:Content' :: Maybe [Ssml]
ssmlList = Maybe [Ssml]
a} :: Content) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The list of text messages.
content_textList :: Lens.Lens' Content (Prelude.Maybe [TextMessage])
content_textList :: Lens' Content (Maybe [TextMessage])
content_textList = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Content' {Maybe [TextMessage]
textList :: Maybe [TextMessage]
$sel:textList:Content' :: Content -> Maybe [TextMessage]
textList} -> Maybe [TextMessage]
textList) (\s :: Content
s@Content' {} Maybe [TextMessage]
a -> Content
s {$sel:textList:Content' :: Maybe [TextMessage]
textList = Maybe [TextMessage]
a} :: Content) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Prelude.Hashable Content where
  hashWithSalt :: Int -> Content -> Int
hashWithSalt Int
_salt Content' {Maybe [Audio]
Maybe [Ssml]
Maybe [TextMessage]
textList :: Maybe [TextMessage]
ssmlList :: Maybe [Ssml]
audioList :: Maybe [Audio]
$sel:textList:Content' :: Content -> Maybe [TextMessage]
$sel:ssmlList:Content' :: Content -> Maybe [Ssml]
$sel:audioList:Content' :: Content -> Maybe [Audio]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Audio]
audioList
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Ssml]
ssmlList
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [TextMessage]
textList

instance Prelude.NFData Content where
  rnf :: Content -> ()
rnf Content' {Maybe [Audio]
Maybe [Ssml]
Maybe [TextMessage]
textList :: Maybe [TextMessage]
ssmlList :: Maybe [Ssml]
audioList :: Maybe [Audio]
$sel:textList:Content' :: Content -> Maybe [TextMessage]
$sel:ssmlList:Content' :: Content -> Maybe [Ssml]
$sel:audioList:Content' :: Content -> Maybe [Audio]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Audio]
audioList
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Ssml]
ssmlList
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [TextMessage]
textList

instance Data.ToJSON Content where
  toJSON :: Content -> Value
toJSON Content' {Maybe [Audio]
Maybe [Ssml]
Maybe [TextMessage]
textList :: Maybe [TextMessage]
ssmlList :: Maybe [Ssml]
audioList :: Maybe [Audio]
$sel:textList:Content' :: Content -> Maybe [TextMessage]
$sel:ssmlList:Content' :: Content -> Maybe [Ssml]
$sel:audioList:Content' :: Content -> Maybe [Audio]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"AudioList" 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 [Audio]
audioList,
            (Key
"SsmlList" 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 [Ssml]
ssmlList,
            (Key
"TextList" 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 [TextMessage]
textList
          ]
      )