{-# 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.SSMContacts.Types.Page
-- 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.SSMContacts.Types.Page 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

-- | Incident Manager engaging a contact\'s contact channel.
--
-- /See:/ 'newPage' smart constructor.
data Page = Page'
  { -- | The time the message was delivered to the contact channel.
    Page -> Maybe POSIX
deliveryTime :: Prelude.Maybe Data.POSIX,
    -- | The ARN of the incident that\'s engaging the contact channel.
    Page -> Maybe Text
incidentId :: Prelude.Maybe Prelude.Text,
    -- | The time that the contact channel acknowledged engagement.
    Page -> Maybe POSIX
readTime :: Prelude.Maybe Data.POSIX,
    -- | The time that Incident Manager engaged the contact channel.
    Page -> Maybe POSIX
sentTime :: Prelude.Maybe Data.POSIX,
    -- | The Amazon Resource Name (ARN) of the page to the contact channel.
    Page -> Text
pageArn :: Prelude.Text,
    -- | The ARN of the engagement that this page is part of.
    Page -> Text
engagementArn :: Prelude.Text,
    -- | The ARN of the contact that Incident Manager is engaging.
    Page -> Text
contactArn :: Prelude.Text,
    -- | The user that started the engagement.
    Page -> Text
sender :: Prelude.Text
  }
  deriving (Page -> Page -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Page -> Page -> Bool
$c/= :: Page -> Page -> Bool
== :: Page -> Page -> Bool
$c== :: Page -> Page -> Bool
Prelude.Eq, ReadPrec [Page]
ReadPrec Page
Int -> ReadS Page
ReadS [Page]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Page]
$creadListPrec :: ReadPrec [Page]
readPrec :: ReadPrec Page
$creadPrec :: ReadPrec Page
readList :: ReadS [Page]
$creadList :: ReadS [Page]
readsPrec :: Int -> ReadS Page
$creadsPrec :: Int -> ReadS Page
Prelude.Read, Int -> Page -> ShowS
[Page] -> ShowS
Page -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Page] -> ShowS
$cshowList :: [Page] -> ShowS
show :: Page -> String
$cshow :: Page -> String
showsPrec :: Int -> Page -> ShowS
$cshowsPrec :: Int -> Page -> ShowS
Prelude.Show, forall x. Rep Page x -> Page
forall x. Page -> Rep Page x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Page x -> Page
$cfrom :: forall x. Page -> Rep Page x
Prelude.Generic)

-- |
-- Create a value of 'Page' 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:
--
-- 'deliveryTime', 'page_deliveryTime' - The time the message was delivered to the contact channel.
--
-- 'incidentId', 'page_incidentId' - The ARN of the incident that\'s engaging the contact channel.
--
-- 'readTime', 'page_readTime' - The time that the contact channel acknowledged engagement.
--
-- 'sentTime', 'page_sentTime' - The time that Incident Manager engaged the contact channel.
--
-- 'pageArn', 'page_pageArn' - The Amazon Resource Name (ARN) of the page to the contact channel.
--
-- 'engagementArn', 'page_engagementArn' - The ARN of the engagement that this page is part of.
--
-- 'contactArn', 'page_contactArn' - The ARN of the contact that Incident Manager is engaging.
--
-- 'sender', 'page_sender' - The user that started the engagement.
newPage ::
  -- | 'pageArn'
  Prelude.Text ->
  -- | 'engagementArn'
  Prelude.Text ->
  -- | 'contactArn'
  Prelude.Text ->
  -- | 'sender'
  Prelude.Text ->
  Page
newPage :: Text -> Text -> Text -> Text -> Page
newPage
  Text
pPageArn_
  Text
pEngagementArn_
  Text
pContactArn_
  Text
pSender_ =
    Page'
      { $sel:deliveryTime:Page' :: Maybe POSIX
deliveryTime = forall a. Maybe a
Prelude.Nothing,
        $sel:incidentId:Page' :: Maybe Text
incidentId = forall a. Maybe a
Prelude.Nothing,
        $sel:readTime:Page' :: Maybe POSIX
readTime = forall a. Maybe a
Prelude.Nothing,
        $sel:sentTime:Page' :: Maybe POSIX
sentTime = forall a. Maybe a
Prelude.Nothing,
        $sel:pageArn:Page' :: Text
pageArn = Text
pPageArn_,
        $sel:engagementArn:Page' :: Text
engagementArn = Text
pEngagementArn_,
        $sel:contactArn:Page' :: Text
contactArn = Text
pContactArn_,
        $sel:sender:Page' :: Text
sender = Text
pSender_
      }

-- | The time the message was delivered to the contact channel.
page_deliveryTime :: Lens.Lens' Page (Prelude.Maybe Prelude.UTCTime)
page_deliveryTime :: Lens' Page (Maybe UTCTime)
page_deliveryTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Page' {Maybe POSIX
deliveryTime :: Maybe POSIX
$sel:deliveryTime:Page' :: Page -> Maybe POSIX
deliveryTime} -> Maybe POSIX
deliveryTime) (\s :: Page
s@Page' {} Maybe POSIX
a -> Page
s {$sel:deliveryTime:Page' :: Maybe POSIX
deliveryTime = Maybe POSIX
a} :: Page) 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

-- | The ARN of the incident that\'s engaging the contact channel.
page_incidentId :: Lens.Lens' Page (Prelude.Maybe Prelude.Text)
page_incidentId :: Lens' Page (Maybe Text)
page_incidentId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Page' {Maybe Text
incidentId :: Maybe Text
$sel:incidentId:Page' :: Page -> Maybe Text
incidentId} -> Maybe Text
incidentId) (\s :: Page
s@Page' {} Maybe Text
a -> Page
s {$sel:incidentId:Page' :: Maybe Text
incidentId = Maybe Text
a} :: Page)

-- | The time that the contact channel acknowledged engagement.
page_readTime :: Lens.Lens' Page (Prelude.Maybe Prelude.UTCTime)
page_readTime :: Lens' Page (Maybe UTCTime)
page_readTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Page' {Maybe POSIX
readTime :: Maybe POSIX
$sel:readTime:Page' :: Page -> Maybe POSIX
readTime} -> Maybe POSIX
readTime) (\s :: Page
s@Page' {} Maybe POSIX
a -> Page
s {$sel:readTime:Page' :: Maybe POSIX
readTime = Maybe POSIX
a} :: Page) 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

-- | The time that Incident Manager engaged the contact channel.
page_sentTime :: Lens.Lens' Page (Prelude.Maybe Prelude.UTCTime)
page_sentTime :: Lens' Page (Maybe UTCTime)
page_sentTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Page' {Maybe POSIX
sentTime :: Maybe POSIX
$sel:sentTime:Page' :: Page -> Maybe POSIX
sentTime} -> Maybe POSIX
sentTime) (\s :: Page
s@Page' {} Maybe POSIX
a -> Page
s {$sel:sentTime:Page' :: Maybe POSIX
sentTime = Maybe POSIX
a} :: Page) 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

-- | The Amazon Resource Name (ARN) of the page to the contact channel.
page_pageArn :: Lens.Lens' Page Prelude.Text
page_pageArn :: Lens' Page Text
page_pageArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Page' {Text
pageArn :: Text
$sel:pageArn:Page' :: Page -> Text
pageArn} -> Text
pageArn) (\s :: Page
s@Page' {} Text
a -> Page
s {$sel:pageArn:Page' :: Text
pageArn = Text
a} :: Page)

-- | The ARN of the engagement that this page is part of.
page_engagementArn :: Lens.Lens' Page Prelude.Text
page_engagementArn :: Lens' Page Text
page_engagementArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Page' {Text
engagementArn :: Text
$sel:engagementArn:Page' :: Page -> Text
engagementArn} -> Text
engagementArn) (\s :: Page
s@Page' {} Text
a -> Page
s {$sel:engagementArn:Page' :: Text
engagementArn = Text
a} :: Page)

-- | The ARN of the contact that Incident Manager is engaging.
page_contactArn :: Lens.Lens' Page Prelude.Text
page_contactArn :: Lens' Page Text
page_contactArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Page' {Text
contactArn :: Text
$sel:contactArn:Page' :: Page -> Text
contactArn} -> Text
contactArn) (\s :: Page
s@Page' {} Text
a -> Page
s {$sel:contactArn:Page' :: Text
contactArn = Text
a} :: Page)

-- | The user that started the engagement.
page_sender :: Lens.Lens' Page Prelude.Text
page_sender :: Lens' Page Text
page_sender = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Page' {Text
sender :: Text
$sel:sender:Page' :: Page -> Text
sender} -> Text
sender) (\s :: Page
s@Page' {} Text
a -> Page
s {$sel:sender:Page' :: Text
sender = Text
a} :: Page)

instance Data.FromJSON Page where
  parseJSON :: Value -> Parser Page
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Page"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Text
-> Maybe POSIX
-> Maybe POSIX
-> Text
-> Text
-> Text
-> Text
-> Page
Page'
            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
"DeliveryTime")
            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
"IncidentId")
            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
"ReadTime")
            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
"SentTime")
            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
"PageArn")
            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
"EngagementArn")
            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
"ContactArn")
            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
"Sender")
      )

instance Prelude.Hashable Page where
  hashWithSalt :: Int -> Page -> Int
hashWithSalt Int
_salt Page' {Maybe Text
Maybe POSIX
Text
sender :: Text
contactArn :: Text
engagementArn :: Text
pageArn :: Text
sentTime :: Maybe POSIX
readTime :: Maybe POSIX
incidentId :: Maybe Text
deliveryTime :: Maybe POSIX
$sel:sender:Page' :: Page -> Text
$sel:contactArn:Page' :: Page -> Text
$sel:engagementArn:Page' :: Page -> Text
$sel:pageArn:Page' :: Page -> Text
$sel:sentTime:Page' :: Page -> Maybe POSIX
$sel:readTime:Page' :: Page -> Maybe POSIX
$sel:incidentId:Page' :: Page -> Maybe Text
$sel:deliveryTime:Page' :: Page -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
deliveryTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
incidentId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
readTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
sentTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
pageArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
engagementArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
contactArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
sender

instance Prelude.NFData Page where
  rnf :: Page -> ()
rnf Page' {Maybe Text
Maybe POSIX
Text
sender :: Text
contactArn :: Text
engagementArn :: Text
pageArn :: Text
sentTime :: Maybe POSIX
readTime :: Maybe POSIX
incidentId :: Maybe Text
deliveryTime :: Maybe POSIX
$sel:sender:Page' :: Page -> Text
$sel:contactArn:Page' :: Page -> Text
$sel:engagementArn:Page' :: Page -> Text
$sel:pageArn:Page' :: Page -> Text
$sel:sentTime:Page' :: Page -> Maybe POSIX
$sel:readTime:Page' :: Page -> Maybe POSIX
$sel:incidentId:Page' :: Page -> Maybe Text
$sel:deliveryTime:Page' :: Page -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
deliveryTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
incidentId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
readTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
sentTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
pageArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
engagementArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
contactArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
sender