{-# 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.AmplifyBackend.Types.SmsSettings
-- 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.AmplifyBackend.Types.SmsSettings where

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

-- | SMS settings for authentication.
--
-- /See:/ 'newSmsSettings' smart constructor.
data SmsSettings = SmsSettings'
  { -- | The body of the SMS message.
    SmsSettings -> Maybe Text
smsMessage :: Prelude.Maybe Prelude.Text
  }
  deriving (SmsSettings -> SmsSettings -> Bool
(SmsSettings -> SmsSettings -> Bool)
-> (SmsSettings -> SmsSettings -> Bool) -> Eq SmsSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SmsSettings -> SmsSettings -> Bool
$c/= :: SmsSettings -> SmsSettings -> Bool
== :: SmsSettings -> SmsSettings -> Bool
$c== :: SmsSettings -> SmsSettings -> Bool
Prelude.Eq, ReadPrec [SmsSettings]
ReadPrec SmsSettings
Int -> ReadS SmsSettings
ReadS [SmsSettings]
(Int -> ReadS SmsSettings)
-> ReadS [SmsSettings]
-> ReadPrec SmsSettings
-> ReadPrec [SmsSettings]
-> Read SmsSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SmsSettings]
$creadListPrec :: ReadPrec [SmsSettings]
readPrec :: ReadPrec SmsSettings
$creadPrec :: ReadPrec SmsSettings
readList :: ReadS [SmsSettings]
$creadList :: ReadS [SmsSettings]
readsPrec :: Int -> ReadS SmsSettings
$creadsPrec :: Int -> ReadS SmsSettings
Prelude.Read, Int -> SmsSettings -> ShowS
[SmsSettings] -> ShowS
SmsSettings -> String
(Int -> SmsSettings -> ShowS)
-> (SmsSettings -> String)
-> ([SmsSettings] -> ShowS)
-> Show SmsSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SmsSettings] -> ShowS
$cshowList :: [SmsSettings] -> ShowS
show :: SmsSettings -> String
$cshow :: SmsSettings -> String
showsPrec :: Int -> SmsSettings -> ShowS
$cshowsPrec :: Int -> SmsSettings -> ShowS
Prelude.Show, (forall x. SmsSettings -> Rep SmsSettings x)
-> (forall x. Rep SmsSettings x -> SmsSettings)
-> Generic SmsSettings
forall x. Rep SmsSettings x -> SmsSettings
forall x. SmsSettings -> Rep SmsSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SmsSettings x -> SmsSettings
$cfrom :: forall x. SmsSettings -> Rep SmsSettings x
Prelude.Generic)

-- |
-- Create a value of 'SmsSettings' 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:
--
-- 'smsMessage', 'smsSettings_smsMessage' - The body of the SMS message.
newSmsSettings ::
  SmsSettings
newSmsSettings :: SmsSettings
newSmsSettings =
  SmsSettings' :: Maybe Text -> SmsSettings
SmsSettings' {$sel:smsMessage:SmsSettings' :: Maybe Text
smsMessage = Maybe Text
forall a. Maybe a
Prelude.Nothing}

-- | The body of the SMS message.
smsSettings_smsMessage :: Lens.Lens' SmsSettings (Prelude.Maybe Prelude.Text)
smsSettings_smsMessage :: (Maybe Text -> f (Maybe Text)) -> SmsSettings -> f SmsSettings
smsSettings_smsMessage = (SmsSettings -> Maybe Text)
-> (SmsSettings -> Maybe Text -> SmsSettings)
-> Lens SmsSettings SmsSettings (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SmsSettings' {Maybe Text
smsMessage :: Maybe Text
$sel:smsMessage:SmsSettings' :: SmsSettings -> Maybe Text
smsMessage} -> Maybe Text
smsMessage) (\s :: SmsSettings
s@SmsSettings' {} Maybe Text
a -> SmsSettings
s {$sel:smsMessage:SmsSettings' :: Maybe Text
smsMessage = Maybe Text
a} :: SmsSettings)

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

instance Prelude.Hashable SmsSettings

instance Prelude.NFData SmsSettings

instance Core.ToJSON SmsSettings where
  toJSON :: SmsSettings -> Value
toJSON SmsSettings' {Maybe Text
smsMessage :: Maybe Text
$sel:smsMessage:SmsSettings' :: SmsSettings -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"smsMessage" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
smsMessage]
      )