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

import Amazonka.AlexaBusiness.Types.Locale
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The text message.
--
-- /See:/ 'newTextMessage' smart constructor.
data TextMessage = TextMessage'
  { -- | The locale of the text message. Currently, en-US is supported.
    TextMessage -> Locale
locale :: Locale,
    -- | The value of the text message.
    TextMessage -> Text
value :: Prelude.Text
  }
  deriving (TextMessage -> TextMessage -> Bool
(TextMessage -> TextMessage -> Bool)
-> (TextMessage -> TextMessage -> Bool) -> Eq TextMessage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TextMessage -> TextMessage -> Bool
$c/= :: TextMessage -> TextMessage -> Bool
== :: TextMessage -> TextMessage -> Bool
$c== :: TextMessage -> TextMessage -> Bool
Prelude.Eq, ReadPrec [TextMessage]
ReadPrec TextMessage
Int -> ReadS TextMessage
ReadS [TextMessage]
(Int -> ReadS TextMessage)
-> ReadS [TextMessage]
-> ReadPrec TextMessage
-> ReadPrec [TextMessage]
-> Read TextMessage
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TextMessage]
$creadListPrec :: ReadPrec [TextMessage]
readPrec :: ReadPrec TextMessage
$creadPrec :: ReadPrec TextMessage
readList :: ReadS [TextMessage]
$creadList :: ReadS [TextMessage]
readsPrec :: Int -> ReadS TextMessage
$creadsPrec :: Int -> ReadS TextMessage
Prelude.Read, Int -> TextMessage -> ShowS
[TextMessage] -> ShowS
TextMessage -> String
(Int -> TextMessage -> ShowS)
-> (TextMessage -> String)
-> ([TextMessage] -> ShowS)
-> Show TextMessage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TextMessage] -> ShowS
$cshowList :: [TextMessage] -> ShowS
show :: TextMessage -> String
$cshow :: TextMessage -> String
showsPrec :: Int -> TextMessage -> ShowS
$cshowsPrec :: Int -> TextMessage -> ShowS
Prelude.Show, (forall x. TextMessage -> Rep TextMessage x)
-> (forall x. Rep TextMessage x -> TextMessage)
-> Generic TextMessage
forall x. Rep TextMessage x -> TextMessage
forall x. TextMessage -> Rep TextMessage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TextMessage x -> TextMessage
$cfrom :: forall x. TextMessage -> Rep TextMessage x
Prelude.Generic)

-- |
-- Create a value of 'TextMessage' 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:
--
-- 'locale', 'textMessage_locale' - The locale of the text message. Currently, en-US is supported.
--
-- 'value', 'textMessage_value' - The value of the text message.
newTextMessage ::
  -- | 'locale'
  Locale ->
  -- | 'value'
  Prelude.Text ->
  TextMessage
newTextMessage :: Locale -> Text -> TextMessage
newTextMessage Locale
pLocale_ Text
pValue_ =
  TextMessage' :: Locale -> Text -> TextMessage
TextMessage' {$sel:locale:TextMessage' :: Locale
locale = Locale
pLocale_, $sel:value:TextMessage' :: Text
value = Text
pValue_}

-- | The locale of the text message. Currently, en-US is supported.
textMessage_locale :: Lens.Lens' TextMessage Locale
textMessage_locale :: (Locale -> f Locale) -> TextMessage -> f TextMessage
textMessage_locale = (TextMessage -> Locale)
-> (TextMessage -> Locale -> TextMessage)
-> Lens TextMessage TextMessage Locale Locale
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TextMessage' {Locale
locale :: Locale
$sel:locale:TextMessage' :: TextMessage -> Locale
locale} -> Locale
locale) (\s :: TextMessage
s@TextMessage' {} Locale
a -> TextMessage
s {$sel:locale:TextMessage' :: Locale
locale = Locale
a} :: TextMessage)

-- | The value of the text message.
textMessage_value :: Lens.Lens' TextMessage Prelude.Text
textMessage_value :: (Text -> f Text) -> TextMessage -> f TextMessage
textMessage_value = (TextMessage -> Text)
-> (TextMessage -> Text -> TextMessage)
-> Lens TextMessage TextMessage Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TextMessage' {Text
value :: Text
$sel:value:TextMessage' :: TextMessage -> Text
value} -> Text
value) (\s :: TextMessage
s@TextMessage' {} Text
a -> TextMessage
s {$sel:value:TextMessage' :: Text
value = Text
a} :: TextMessage)

instance Prelude.Hashable TextMessage

instance Prelude.NFData TextMessage

instance Core.ToJSON TextMessage where
  toJSON :: TextMessage -> Value
toJSON TextMessage' {Text
Locale
value :: Text
locale :: Locale
$sel:value:TextMessage' :: TextMessage -> Text
$sel:locale:TextMessage' :: TextMessage -> Locale
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Locale" Text -> Locale -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Locale
locale),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Value" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
value)
          ]
      )