{-# 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.OptedOutNumberInformation
-- 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.OptedOutNumberInformation 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 information for an opted out number in an Amazon Web Services
-- account.
--
-- /See:/ 'newOptedOutNumberInformation' smart constructor.
data OptedOutNumberInformation = OptedOutNumberInformation'
  { -- | The phone number that is opted out.
    OptedOutNumberInformation -> Text
optedOutNumber :: Prelude.Text,
    -- | The time that the op tout occurred, in
    -- <https://www.epochconverter.com/ UNIX epoch time> format.
    OptedOutNumberInformation -> POSIX
optedOutTimestamp :: Data.POSIX,
    -- | This is set to true if it was the end recipient that opted out.
    OptedOutNumberInformation -> Bool
endUserOptedOut :: Prelude.Bool
  }
  deriving (OptedOutNumberInformation -> OptedOutNumberInformation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OptedOutNumberInformation -> OptedOutNumberInformation -> Bool
$c/= :: OptedOutNumberInformation -> OptedOutNumberInformation -> Bool
== :: OptedOutNumberInformation -> OptedOutNumberInformation -> Bool
$c== :: OptedOutNumberInformation -> OptedOutNumberInformation -> Bool
Prelude.Eq, ReadPrec [OptedOutNumberInformation]
ReadPrec OptedOutNumberInformation
Int -> ReadS OptedOutNumberInformation
ReadS [OptedOutNumberInformation]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OptedOutNumberInformation]
$creadListPrec :: ReadPrec [OptedOutNumberInformation]
readPrec :: ReadPrec OptedOutNumberInformation
$creadPrec :: ReadPrec OptedOutNumberInformation
readList :: ReadS [OptedOutNumberInformation]
$creadList :: ReadS [OptedOutNumberInformation]
readsPrec :: Int -> ReadS OptedOutNumberInformation
$creadsPrec :: Int -> ReadS OptedOutNumberInformation
Prelude.Read, Int -> OptedOutNumberInformation -> ShowS
[OptedOutNumberInformation] -> ShowS
OptedOutNumberInformation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OptedOutNumberInformation] -> ShowS
$cshowList :: [OptedOutNumberInformation] -> ShowS
show :: OptedOutNumberInformation -> String
$cshow :: OptedOutNumberInformation -> String
showsPrec :: Int -> OptedOutNumberInformation -> ShowS
$cshowsPrec :: Int -> OptedOutNumberInformation -> ShowS
Prelude.Show, forall x.
Rep OptedOutNumberInformation x -> OptedOutNumberInformation
forall x.
OptedOutNumberInformation -> Rep OptedOutNumberInformation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep OptedOutNumberInformation x -> OptedOutNumberInformation
$cfrom :: forall x.
OptedOutNumberInformation -> Rep OptedOutNumberInformation x
Prelude.Generic)

-- |
-- Create a value of 'OptedOutNumberInformation' 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:
--
-- 'optedOutNumber', 'optedOutNumberInformation_optedOutNumber' - The phone number that is opted out.
--
-- 'optedOutTimestamp', 'optedOutNumberInformation_optedOutTimestamp' - The time that the op tout occurred, in
-- <https://www.epochconverter.com/ UNIX epoch time> format.
--
-- 'endUserOptedOut', 'optedOutNumberInformation_endUserOptedOut' - This is set to true if it was the end recipient that opted out.
newOptedOutNumberInformation ::
  -- | 'optedOutNumber'
  Prelude.Text ->
  -- | 'optedOutTimestamp'
  Prelude.UTCTime ->
  -- | 'endUserOptedOut'
  Prelude.Bool ->
  OptedOutNumberInformation
newOptedOutNumberInformation :: Text -> UTCTime -> Bool -> OptedOutNumberInformation
newOptedOutNumberInformation
  Text
pOptedOutNumber_
  UTCTime
pOptedOutTimestamp_
  Bool
pEndUserOptedOut_ =
    OptedOutNumberInformation'
      { $sel:optedOutNumber:OptedOutNumberInformation' :: Text
optedOutNumber =
          Text
pOptedOutNumber_,
        $sel:optedOutTimestamp:OptedOutNumberInformation' :: POSIX
optedOutTimestamp =
          forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pOptedOutTimestamp_,
        $sel:endUserOptedOut:OptedOutNumberInformation' :: Bool
endUserOptedOut = Bool
pEndUserOptedOut_
      }

-- | The phone number that is opted out.
optedOutNumberInformation_optedOutNumber :: Lens.Lens' OptedOutNumberInformation Prelude.Text
optedOutNumberInformation_optedOutNumber :: Lens' OptedOutNumberInformation Text
optedOutNumberInformation_optedOutNumber = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OptedOutNumberInformation' {Text
optedOutNumber :: Text
$sel:optedOutNumber:OptedOutNumberInformation' :: OptedOutNumberInformation -> Text
optedOutNumber} -> Text
optedOutNumber) (\s :: OptedOutNumberInformation
s@OptedOutNumberInformation' {} Text
a -> OptedOutNumberInformation
s {$sel:optedOutNumber:OptedOutNumberInformation' :: Text
optedOutNumber = Text
a} :: OptedOutNumberInformation)

-- | The time that the op tout occurred, in
-- <https://www.epochconverter.com/ UNIX epoch time> format.
optedOutNumberInformation_optedOutTimestamp :: Lens.Lens' OptedOutNumberInformation Prelude.UTCTime
optedOutNumberInformation_optedOutTimestamp :: Lens' OptedOutNumberInformation UTCTime
optedOutNumberInformation_optedOutTimestamp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OptedOutNumberInformation' {POSIX
optedOutTimestamp :: POSIX
$sel:optedOutTimestamp:OptedOutNumberInformation' :: OptedOutNumberInformation -> POSIX
optedOutTimestamp} -> POSIX
optedOutTimestamp) (\s :: OptedOutNumberInformation
s@OptedOutNumberInformation' {} POSIX
a -> OptedOutNumberInformation
s {$sel:optedOutTimestamp:OptedOutNumberInformation' :: POSIX
optedOutTimestamp = POSIX
a} :: OptedOutNumberInformation) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | This is set to true if it was the end recipient that opted out.
optedOutNumberInformation_endUserOptedOut :: Lens.Lens' OptedOutNumberInformation Prelude.Bool
optedOutNumberInformation_endUserOptedOut :: Lens' OptedOutNumberInformation Bool
optedOutNumberInformation_endUserOptedOut = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OptedOutNumberInformation' {Bool
endUserOptedOut :: Bool
$sel:endUserOptedOut:OptedOutNumberInformation' :: OptedOutNumberInformation -> Bool
endUserOptedOut} -> Bool
endUserOptedOut) (\s :: OptedOutNumberInformation
s@OptedOutNumberInformation' {} Bool
a -> OptedOutNumberInformation
s {$sel:endUserOptedOut:OptedOutNumberInformation' :: Bool
endUserOptedOut = Bool
a} :: OptedOutNumberInformation)

instance Data.FromJSON OptedOutNumberInformation where
  parseJSON :: Value -> Parser OptedOutNumberInformation
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"OptedOutNumberInformation"
      ( \Object
x ->
          Text -> POSIX -> Bool -> OptedOutNumberInformation
OptedOutNumberInformation'
            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
"OptedOutNumber")
            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
"OptedOutTimestamp")
            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
"EndUserOptedOut")
      )

instance Prelude.Hashable OptedOutNumberInformation where
  hashWithSalt :: Int -> OptedOutNumberInformation -> Int
hashWithSalt Int
_salt OptedOutNumberInformation' {Bool
Text
POSIX
endUserOptedOut :: Bool
optedOutTimestamp :: POSIX
optedOutNumber :: Text
$sel:endUserOptedOut:OptedOutNumberInformation' :: OptedOutNumberInformation -> Bool
$sel:optedOutTimestamp:OptedOutNumberInformation' :: OptedOutNumberInformation -> POSIX
$sel:optedOutNumber:OptedOutNumberInformation' :: OptedOutNumberInformation -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
optedOutNumber
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
optedOutTimestamp
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Bool
endUserOptedOut

instance Prelude.NFData OptedOutNumberInformation where
  rnf :: OptedOutNumberInformation -> ()
rnf OptedOutNumberInformation' {Bool
Text
POSIX
endUserOptedOut :: Bool
optedOutTimestamp :: POSIX
optedOutNumber :: Text
$sel:endUserOptedOut:OptedOutNumberInformation' :: OptedOutNumberInformation -> Bool
$sel:optedOutTimestamp:OptedOutNumberInformation' :: OptedOutNumberInformation -> POSIX
$sel:optedOutNumber:OptedOutNumberInformation' :: OptedOutNumberInformation -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
optedOutNumber
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
optedOutTimestamp
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Bool
endUserOptedOut