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

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

-- | Incident Manager engaging a contact\'s contact channel.
--
-- /See:/ 'newPage' smart constructor.
data Page = Page'
  { -- | The time that the contact channel acknowledged engagement.
    Page -> Maybe POSIX
readTime :: Prelude.Maybe Core.POSIX,
    -- | The time the message was delivered to the contact channel.
    Page -> Maybe POSIX
deliveryTime :: Prelude.Maybe Core.POSIX,
    -- | The ARN of the incident that\'s engaging the contact channel.
    Page -> Maybe Text
incidentId :: Prelude.Maybe Prelude.Text,
    -- | The time that Incident Manager engaged the contact channel.
    Page -> Maybe POSIX
sentTime :: Prelude.Maybe Core.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
(Page -> Page -> Bool) -> (Page -> Page -> Bool) -> Eq Page
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]
(Int -> ReadS Page)
-> ReadS [Page] -> ReadPrec Page -> ReadPrec [Page] -> Read 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
(Int -> Page -> ShowS)
-> (Page -> String) -> ([Page] -> ShowS) -> Show Page
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. Page -> Rep Page x)
-> (forall x. Rep Page x -> Page) -> Generic Page
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:
--
-- 'readTime', 'page_readTime' - The time that the contact channel acknowledged engagement.
--
-- '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.
--
-- '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' :: Maybe POSIX
-> Maybe POSIX
-> Maybe Text
-> Maybe POSIX
-> Text
-> Text
-> Text
-> Text
-> Page
Page'
      { $sel:readTime:Page' :: Maybe POSIX
readTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
        $sel:deliveryTime:Page' :: Maybe POSIX
deliveryTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
        $sel:incidentId:Page' :: Maybe Text
incidentId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:sentTime:Page' :: Maybe POSIX
sentTime = Maybe POSIX
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 that the contact channel acknowledged engagement.
page_readTime :: Lens.Lens' Page (Prelude.Maybe Prelude.UTCTime)
page_readTime :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Page -> f Page
page_readTime = (Page -> Maybe POSIX)
-> (Page -> Maybe POSIX -> Page)
-> Lens Page Page (Maybe POSIX) (Maybe POSIX)
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) ((Maybe POSIX -> f (Maybe POSIX)) -> Page -> f Page)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Page
-> f Page
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The time the message was delivered to the contact channel.
page_deliveryTime :: Lens.Lens' Page (Prelude.Maybe Prelude.UTCTime)
page_deliveryTime :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Page -> f Page
page_deliveryTime = (Page -> Maybe POSIX)
-> (Page -> Maybe POSIX -> Page)
-> Lens Page Page (Maybe POSIX) (Maybe POSIX)
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) ((Maybe POSIX -> f (Maybe POSIX)) -> Page -> f Page)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Page
-> f Page
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The ARN of the incident that\'s engaging the contact channel.
page_incidentId :: Lens.Lens' Page (Prelude.Maybe Prelude.Text)
page_incidentId :: (Maybe Text -> f (Maybe Text)) -> Page -> f Page
page_incidentId = (Page -> Maybe Text)
-> (Page -> Maybe Text -> Page)
-> Lens Page Page (Maybe Text) (Maybe Text)
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 Incident Manager engaged the contact channel.
page_sentTime :: Lens.Lens' Page (Prelude.Maybe Prelude.UTCTime)
page_sentTime :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Page -> f Page
page_sentTime = (Page -> Maybe POSIX)
-> (Page -> Maybe POSIX -> Page)
-> Lens Page Page (Maybe POSIX) (Maybe POSIX)
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) ((Maybe POSIX -> f (Maybe POSIX)) -> Page -> f Page)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Page
-> f Page
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The Amazon Resource Name (ARN) of the page to the contact channel.
page_pageArn :: Lens.Lens' Page Prelude.Text
page_pageArn :: (Text -> f Text) -> Page -> f Page
page_pageArn = (Page -> Text)
-> (Page -> Text -> Page) -> Lens Page Page Text Text
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 :: (Text -> f Text) -> Page -> f Page
page_engagementArn = (Page -> Text)
-> (Page -> Text -> Page) -> Lens Page Page Text Text
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 :: (Text -> f Text) -> Page -> f Page
page_contactArn = (Page -> Text)
-> (Page -> Text -> Page) -> Lens Page Page Text Text
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 :: (Text -> f Text) -> Page -> f Page
page_sender = (Page -> Text)
-> (Page -> Text -> Page) -> Lens Page Page Text Text
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 Core.FromJSON Page where
  parseJSON :: Value -> Parser Page
parseJSON =
    String -> (Object -> Parser Page) -> Value -> Parser Page
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Page"
      ( \Object
x ->
          Maybe POSIX
-> Maybe POSIX
-> Maybe Text
-> Maybe POSIX
-> Text
-> Text
-> Text
-> Text
-> Page
Page'
            (Maybe POSIX
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe POSIX
 -> Text
 -> Text
 -> Text
 -> Text
 -> Page)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe POSIX
      -> Maybe Text
      -> Maybe POSIX
      -> Text
      -> Text
      -> Text
      -> Text
      -> Page)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ReadTime")
            Parser
  (Maybe POSIX
   -> Maybe Text
   -> Maybe POSIX
   -> Text
   -> Text
   -> Text
   -> Text
   -> Page)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text -> Maybe POSIX -> Text -> Text -> Text -> Text -> Page)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DeliveryTime")
            Parser
  (Maybe Text -> Maybe POSIX -> Text -> Text -> Text -> Text -> Page)
-> Parser (Maybe Text)
-> Parser (Maybe POSIX -> Text -> Text -> Text -> Text -> Page)
forall (f :: * -> *) a b. Applicative f => 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
"IncidentId")
            Parser (Maybe POSIX -> Text -> Text -> Text -> Text -> Page)
-> Parser (Maybe POSIX)
-> Parser (Text -> Text -> Text -> Text -> Page)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SentTime")
            Parser (Text -> Text -> Text -> Text -> Page)
-> Parser Text -> Parser (Text -> Text -> Text -> Page)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"PageArn")
            Parser (Text -> Text -> Text -> Page)
-> Parser Text -> Parser (Text -> Text -> Page)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"EngagementArn")
            Parser (Text -> Text -> Page)
-> Parser Text -> Parser (Text -> Page)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"ContactArn")
            Parser (Text -> Page) -> Parser Text -> Parser Page
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Sender")
      )

instance Prelude.Hashable Page

instance Prelude.NFData Page