{-# 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.PinpointSmsVoiceV2.Types.ConfigurationSetInformation
-- 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.PinpointSmsVoiceV2.Types.ConfigurationSetInformation where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.PinpointSmsVoiceV2.Types.EventDestination
import Amazonka.PinpointSmsVoiceV2.Types.MessageType
import qualified Amazonka.Prelude as Prelude

-- | Information related to a given configuration set in your Amazon Web
-- Services account.
--
-- /See:/ 'newConfigurationSetInformation' smart constructor.
data ConfigurationSetInformation = ConfigurationSetInformation'
  { -- | The type of message. Valid values are TRANSACTIONAL for messages that
    -- are critical or time-sensitive and PROMOTIONAL for messages that aren\'t
    -- critical or time-sensitive.
    ConfigurationSetInformation -> Maybe MessageType
defaultMessageType :: Prelude.Maybe MessageType,
    -- | The default sender ID used by the ConfigurationSet.
    ConfigurationSetInformation -> Maybe Text
defaultSenderId :: Prelude.Maybe Prelude.Text,
    -- | The Resource Name (ARN) of the ConfigurationSet.
    ConfigurationSetInformation -> Text
configurationSetArn :: Prelude.Text,
    -- | The name of the ConfigurationSet.
    ConfigurationSetInformation -> Text
configurationSetName :: Prelude.Text,
    -- | An array of EventDestination objects that describe any events to log and
    -- where to log them.
    ConfigurationSetInformation -> [EventDestination]
eventDestinations :: [EventDestination],
    -- | The time when the ConfigurationSet was created, in
    -- <https://www.epochconverter.com/ UNIX epoch time> format.
    ConfigurationSetInformation -> POSIX
createdTimestamp :: Data.POSIX
  }
  deriving (ConfigurationSetInformation -> ConfigurationSetInformation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConfigurationSetInformation -> ConfigurationSetInformation -> Bool
$c/= :: ConfigurationSetInformation -> ConfigurationSetInformation -> Bool
== :: ConfigurationSetInformation -> ConfigurationSetInformation -> Bool
$c== :: ConfigurationSetInformation -> ConfigurationSetInformation -> Bool
Prelude.Eq, ReadPrec [ConfigurationSetInformation]
ReadPrec ConfigurationSetInformation
Int -> ReadS ConfigurationSetInformation
ReadS [ConfigurationSetInformation]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConfigurationSetInformation]
$creadListPrec :: ReadPrec [ConfigurationSetInformation]
readPrec :: ReadPrec ConfigurationSetInformation
$creadPrec :: ReadPrec ConfigurationSetInformation
readList :: ReadS [ConfigurationSetInformation]
$creadList :: ReadS [ConfigurationSetInformation]
readsPrec :: Int -> ReadS ConfigurationSetInformation
$creadsPrec :: Int -> ReadS ConfigurationSetInformation
Prelude.Read, Int -> ConfigurationSetInformation -> ShowS
[ConfigurationSetInformation] -> ShowS
ConfigurationSetInformation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConfigurationSetInformation] -> ShowS
$cshowList :: [ConfigurationSetInformation] -> ShowS
show :: ConfigurationSetInformation -> String
$cshow :: ConfigurationSetInformation -> String
showsPrec :: Int -> ConfigurationSetInformation -> ShowS
$cshowsPrec :: Int -> ConfigurationSetInformation -> ShowS
Prelude.Show, forall x.
Rep ConfigurationSetInformation x -> ConfigurationSetInformation
forall x.
ConfigurationSetInformation -> Rep ConfigurationSetInformation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ConfigurationSetInformation x -> ConfigurationSetInformation
$cfrom :: forall x.
ConfigurationSetInformation -> Rep ConfigurationSetInformation x
Prelude.Generic)

-- |
-- Create a value of 'ConfigurationSetInformation' 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:
--
-- 'defaultMessageType', 'configurationSetInformation_defaultMessageType' - The type of message. Valid values are TRANSACTIONAL for messages that
-- are critical or time-sensitive and PROMOTIONAL for messages that aren\'t
-- critical or time-sensitive.
--
-- 'defaultSenderId', 'configurationSetInformation_defaultSenderId' - The default sender ID used by the ConfigurationSet.
--
-- 'configurationSetArn', 'configurationSetInformation_configurationSetArn' - The Resource Name (ARN) of the ConfigurationSet.
--
-- 'configurationSetName', 'configurationSetInformation_configurationSetName' - The name of the ConfigurationSet.
--
-- 'eventDestinations', 'configurationSetInformation_eventDestinations' - An array of EventDestination objects that describe any events to log and
-- where to log them.
--
-- 'createdTimestamp', 'configurationSetInformation_createdTimestamp' - The time when the ConfigurationSet was created, in
-- <https://www.epochconverter.com/ UNIX epoch time> format.
newConfigurationSetInformation ::
  -- | 'configurationSetArn'
  Prelude.Text ->
  -- | 'configurationSetName'
  Prelude.Text ->
  -- | 'createdTimestamp'
  Prelude.UTCTime ->
  ConfigurationSetInformation
newConfigurationSetInformation :: Text -> Text -> UTCTime -> ConfigurationSetInformation
newConfigurationSetInformation
  Text
pConfigurationSetArn_
  Text
pConfigurationSetName_
  UTCTime
pCreatedTimestamp_ =
    ConfigurationSetInformation'
      { $sel:defaultMessageType:ConfigurationSetInformation' :: Maybe MessageType
defaultMessageType =
          forall a. Maybe a
Prelude.Nothing,
        $sel:defaultSenderId:ConfigurationSetInformation' :: Maybe Text
defaultSenderId = forall a. Maybe a
Prelude.Nothing,
        $sel:configurationSetArn:ConfigurationSetInformation' :: Text
configurationSetArn = Text
pConfigurationSetArn_,
        $sel:configurationSetName:ConfigurationSetInformation' :: Text
configurationSetName = Text
pConfigurationSetName_,
        $sel:eventDestinations:ConfigurationSetInformation' :: [EventDestination]
eventDestinations = forall a. Monoid a => a
Prelude.mempty,
        $sel:createdTimestamp:ConfigurationSetInformation' :: POSIX
createdTimestamp =
          forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pCreatedTimestamp_
      }

-- | The type of message. Valid values are TRANSACTIONAL for messages that
-- are critical or time-sensitive and PROMOTIONAL for messages that aren\'t
-- critical or time-sensitive.
configurationSetInformation_defaultMessageType :: Lens.Lens' ConfigurationSetInformation (Prelude.Maybe MessageType)
configurationSetInformation_defaultMessageType :: Lens' ConfigurationSetInformation (Maybe MessageType)
configurationSetInformation_defaultMessageType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigurationSetInformation' {Maybe MessageType
defaultMessageType :: Maybe MessageType
$sel:defaultMessageType:ConfigurationSetInformation' :: ConfigurationSetInformation -> Maybe MessageType
defaultMessageType} -> Maybe MessageType
defaultMessageType) (\s :: ConfigurationSetInformation
s@ConfigurationSetInformation' {} Maybe MessageType
a -> ConfigurationSetInformation
s {$sel:defaultMessageType:ConfigurationSetInformation' :: Maybe MessageType
defaultMessageType = Maybe MessageType
a} :: ConfigurationSetInformation)

-- | The default sender ID used by the ConfigurationSet.
configurationSetInformation_defaultSenderId :: Lens.Lens' ConfigurationSetInformation (Prelude.Maybe Prelude.Text)
configurationSetInformation_defaultSenderId :: Lens' ConfigurationSetInformation (Maybe Text)
configurationSetInformation_defaultSenderId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigurationSetInformation' {Maybe Text
defaultSenderId :: Maybe Text
$sel:defaultSenderId:ConfigurationSetInformation' :: ConfigurationSetInformation -> Maybe Text
defaultSenderId} -> Maybe Text
defaultSenderId) (\s :: ConfigurationSetInformation
s@ConfigurationSetInformation' {} Maybe Text
a -> ConfigurationSetInformation
s {$sel:defaultSenderId:ConfigurationSetInformation' :: Maybe Text
defaultSenderId = Maybe Text
a} :: ConfigurationSetInformation)

-- | The Resource Name (ARN) of the ConfigurationSet.
configurationSetInformation_configurationSetArn :: Lens.Lens' ConfigurationSetInformation Prelude.Text
configurationSetInformation_configurationSetArn :: Lens' ConfigurationSetInformation Text
configurationSetInformation_configurationSetArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigurationSetInformation' {Text
configurationSetArn :: Text
$sel:configurationSetArn:ConfigurationSetInformation' :: ConfigurationSetInformation -> Text
configurationSetArn} -> Text
configurationSetArn) (\s :: ConfigurationSetInformation
s@ConfigurationSetInformation' {} Text
a -> ConfigurationSetInformation
s {$sel:configurationSetArn:ConfigurationSetInformation' :: Text
configurationSetArn = Text
a} :: ConfigurationSetInformation)

-- | The name of the ConfigurationSet.
configurationSetInformation_configurationSetName :: Lens.Lens' ConfigurationSetInformation Prelude.Text
configurationSetInformation_configurationSetName :: Lens' ConfigurationSetInformation Text
configurationSetInformation_configurationSetName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigurationSetInformation' {Text
configurationSetName :: Text
$sel:configurationSetName:ConfigurationSetInformation' :: ConfigurationSetInformation -> Text
configurationSetName} -> Text
configurationSetName) (\s :: ConfigurationSetInformation
s@ConfigurationSetInformation' {} Text
a -> ConfigurationSetInformation
s {$sel:configurationSetName:ConfigurationSetInformation' :: Text
configurationSetName = Text
a} :: ConfigurationSetInformation)

-- | An array of EventDestination objects that describe any events to log and
-- where to log them.
configurationSetInformation_eventDestinations :: Lens.Lens' ConfigurationSetInformation [EventDestination]
configurationSetInformation_eventDestinations :: Lens' ConfigurationSetInformation [EventDestination]
configurationSetInformation_eventDestinations = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigurationSetInformation' {[EventDestination]
eventDestinations :: [EventDestination]
$sel:eventDestinations:ConfigurationSetInformation' :: ConfigurationSetInformation -> [EventDestination]
eventDestinations} -> [EventDestination]
eventDestinations) (\s :: ConfigurationSetInformation
s@ConfigurationSetInformation' {} [EventDestination]
a -> ConfigurationSetInformation
s {$sel:eventDestinations:ConfigurationSetInformation' :: [EventDestination]
eventDestinations = [EventDestination]
a} :: ConfigurationSetInformation) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The time when the ConfigurationSet was created, in
-- <https://www.epochconverter.com/ UNIX epoch time> format.
configurationSetInformation_createdTimestamp :: Lens.Lens' ConfigurationSetInformation Prelude.UTCTime
configurationSetInformation_createdTimestamp :: Lens' ConfigurationSetInformation UTCTime
configurationSetInformation_createdTimestamp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigurationSetInformation' {POSIX
createdTimestamp :: POSIX
$sel:createdTimestamp:ConfigurationSetInformation' :: ConfigurationSetInformation -> POSIX
createdTimestamp} -> POSIX
createdTimestamp) (\s :: ConfigurationSetInformation
s@ConfigurationSetInformation' {} POSIX
a -> ConfigurationSetInformation
s {$sel:createdTimestamp:ConfigurationSetInformation' :: POSIX
createdTimestamp = POSIX
a} :: ConfigurationSetInformation) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

instance Data.FromJSON ConfigurationSetInformation where
  parseJSON :: Value -> Parser ConfigurationSetInformation
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ConfigurationSetInformation"
      ( \Object
x ->
          Maybe MessageType
-> Maybe Text
-> Text
-> Text
-> [EventDestination]
-> POSIX
-> ConfigurationSetInformation
ConfigurationSetInformation'
            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
"DefaultMessageType")
            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
"DefaultSenderId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"ConfigurationSetArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"ConfigurationSetName")
            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
"EventDestinations"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"CreatedTimestamp")
      )

instance Prelude.Hashable ConfigurationSetInformation where
  hashWithSalt :: Int -> ConfigurationSetInformation -> Int
hashWithSalt Int
_salt ConfigurationSetInformation' {[EventDestination]
Maybe Text
Maybe MessageType
Text
POSIX
createdTimestamp :: POSIX
eventDestinations :: [EventDestination]
configurationSetName :: Text
configurationSetArn :: Text
defaultSenderId :: Maybe Text
defaultMessageType :: Maybe MessageType
$sel:createdTimestamp:ConfigurationSetInformation' :: ConfigurationSetInformation -> POSIX
$sel:eventDestinations:ConfigurationSetInformation' :: ConfigurationSetInformation -> [EventDestination]
$sel:configurationSetName:ConfigurationSetInformation' :: ConfigurationSetInformation -> Text
$sel:configurationSetArn:ConfigurationSetInformation' :: ConfigurationSetInformation -> Text
$sel:defaultSenderId:ConfigurationSetInformation' :: ConfigurationSetInformation -> Maybe Text
$sel:defaultMessageType:ConfigurationSetInformation' :: ConfigurationSetInformation -> Maybe MessageType
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe MessageType
defaultMessageType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
defaultSenderId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
configurationSetArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
configurationSetName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [EventDestination]
eventDestinations
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
createdTimestamp

instance Prelude.NFData ConfigurationSetInformation where
  rnf :: ConfigurationSetInformation -> ()
rnf ConfigurationSetInformation' {[EventDestination]
Maybe Text
Maybe MessageType
Text
POSIX
createdTimestamp :: POSIX
eventDestinations :: [EventDestination]
configurationSetName :: Text
configurationSetArn :: Text
defaultSenderId :: Maybe Text
defaultMessageType :: Maybe MessageType
$sel:createdTimestamp:ConfigurationSetInformation' :: ConfigurationSetInformation -> POSIX
$sel:eventDestinations:ConfigurationSetInformation' :: ConfigurationSetInformation -> [EventDestination]
$sel:configurationSetName:ConfigurationSetInformation' :: ConfigurationSetInformation -> Text
$sel:configurationSetArn:ConfigurationSetInformation' :: ConfigurationSetInformation -> Text
$sel:defaultSenderId:ConfigurationSetInformation' :: ConfigurationSetInformation -> Maybe Text
$sel:defaultMessageType:ConfigurationSetInformation' :: ConfigurationSetInformation -> Maybe MessageType
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe MessageType
defaultMessageType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
defaultSenderId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
configurationSetArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
configurationSetName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [EventDestination]
eventDestinations
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
createdTimestamp