{-# 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.SESV2.Types.ContactList
-- 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.SESV2.Types.ContactList 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

-- | A list that contains contacts that have subscribed to a particular topic
-- or topics.
--
-- /See:/ 'newContactList' smart constructor.
data ContactList = ContactList'
  { -- | The name of the contact list.
    ContactList -> Maybe Text
contactListName :: Prelude.Maybe Prelude.Text,
    -- | A timestamp noting the last time the contact list was updated.
    ContactList -> Maybe POSIX
lastUpdatedTimestamp :: Prelude.Maybe Data.POSIX
  }
  deriving (ContactList -> ContactList -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ContactList -> ContactList -> Bool
$c/= :: ContactList -> ContactList -> Bool
== :: ContactList -> ContactList -> Bool
$c== :: ContactList -> ContactList -> Bool
Prelude.Eq, ReadPrec [ContactList]
ReadPrec ContactList
Int -> ReadS ContactList
ReadS [ContactList]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ContactList]
$creadListPrec :: ReadPrec [ContactList]
readPrec :: ReadPrec ContactList
$creadPrec :: ReadPrec ContactList
readList :: ReadS [ContactList]
$creadList :: ReadS [ContactList]
readsPrec :: Int -> ReadS ContactList
$creadsPrec :: Int -> ReadS ContactList
Prelude.Read, Int -> ContactList -> ShowS
[ContactList] -> ShowS
ContactList -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ContactList] -> ShowS
$cshowList :: [ContactList] -> ShowS
show :: ContactList -> String
$cshow :: ContactList -> String
showsPrec :: Int -> ContactList -> ShowS
$cshowsPrec :: Int -> ContactList -> ShowS
Prelude.Show, forall x. Rep ContactList x -> ContactList
forall x. ContactList -> Rep ContactList x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ContactList x -> ContactList
$cfrom :: forall x. ContactList -> Rep ContactList x
Prelude.Generic)

-- |
-- Create a value of 'ContactList' 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:
--
-- 'contactListName', 'contactList_contactListName' - The name of the contact list.
--
-- 'lastUpdatedTimestamp', 'contactList_lastUpdatedTimestamp' - A timestamp noting the last time the contact list was updated.
newContactList ::
  ContactList
newContactList :: ContactList
newContactList =
  ContactList'
    { $sel:contactListName:ContactList' :: Maybe Text
contactListName = forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedTimestamp:ContactList' :: Maybe POSIX
lastUpdatedTimestamp = forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the contact list.
contactList_contactListName :: Lens.Lens' ContactList (Prelude.Maybe Prelude.Text)
contactList_contactListName :: Lens' ContactList (Maybe Text)
contactList_contactListName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContactList' {Maybe Text
contactListName :: Maybe Text
$sel:contactListName:ContactList' :: ContactList -> Maybe Text
contactListName} -> Maybe Text
contactListName) (\s :: ContactList
s@ContactList' {} Maybe Text
a -> ContactList
s {$sel:contactListName:ContactList' :: Maybe Text
contactListName = Maybe Text
a} :: ContactList)

-- | A timestamp noting the last time the contact list was updated.
contactList_lastUpdatedTimestamp :: Lens.Lens' ContactList (Prelude.Maybe Prelude.UTCTime)
contactList_lastUpdatedTimestamp :: Lens' ContactList (Maybe UTCTime)
contactList_lastUpdatedTimestamp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContactList' {Maybe POSIX
lastUpdatedTimestamp :: Maybe POSIX
$sel:lastUpdatedTimestamp:ContactList' :: ContactList -> Maybe POSIX
lastUpdatedTimestamp} -> Maybe POSIX
lastUpdatedTimestamp) (\s :: ContactList
s@ContactList' {} Maybe POSIX
a -> ContactList
s {$sel:lastUpdatedTimestamp:ContactList' :: Maybe POSIX
lastUpdatedTimestamp = Maybe POSIX
a} :: ContactList) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time

instance Data.FromJSON ContactList where
  parseJSON :: Value -> Parser ContactList
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ContactList"
      ( \Object
x ->
          Maybe Text -> Maybe POSIX -> ContactList
ContactList'
            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
"ContactListName")
            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
"LastUpdatedTimestamp")
      )

instance Prelude.Hashable ContactList where
  hashWithSalt :: Int -> ContactList -> Int
hashWithSalt Int
_salt ContactList' {Maybe Text
Maybe POSIX
lastUpdatedTimestamp :: Maybe POSIX
contactListName :: Maybe Text
$sel:lastUpdatedTimestamp:ContactList' :: ContactList -> Maybe POSIX
$sel:contactListName:ContactList' :: ContactList -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
contactListName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastUpdatedTimestamp

instance Prelude.NFData ContactList where
  rnf :: ContactList -> ()
rnf ContactList' {Maybe Text
Maybe POSIX
lastUpdatedTimestamp :: Maybe POSIX
contactListName :: Maybe Text
$sel:lastUpdatedTimestamp:ContactList' :: ContactList -> Maybe POSIX
$sel:contactListName:ContactList' :: ContactList -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
contactListName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastUpdatedTimestamp