{-# 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.MediaLive.Types.Esam
-- 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.MediaLive.Types.Esam 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

-- | Esam
--
-- /See:/ 'newEsam' smart constructor.
data Esam = Esam'
  { -- | When specified, this offset (in milliseconds) is added to the input Ad
    -- Avail PTS time. This only applies to embedded SCTE 104\/35 messages and
    -- does not apply to OOB messages.
    Esam -> Maybe Int
adAvailOffset :: Prelude.Maybe Prelude.Int,
    -- | Documentation update needed
    Esam -> Maybe Text
passwordParam :: Prelude.Maybe Prelude.Text,
    -- | Documentation update needed
    Esam -> Maybe Text
username :: Prelude.Maybe Prelude.Text,
    -- | Optional data sent as zoneIdentity to identify the MediaLive channel to
    -- the POIS.
    Esam -> Maybe Text
zoneIdentity :: Prelude.Maybe Prelude.Text,
    -- | Sent as acquisitionPointIdentity to identify the MediaLive channel to
    -- the POIS.
    Esam -> Text
acquisitionPointId :: Prelude.Text,
    -- | The URL of the signal conditioner endpoint on the Placement Opportunity
    -- Information System (POIS). MediaLive sends SignalProcessingEvents here
    -- when SCTE-35 messages are read.
    Esam -> Text
poisEndpoint :: Prelude.Text
  }
  deriving (Esam -> Esam -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Esam -> Esam -> Bool
$c/= :: Esam -> Esam -> Bool
== :: Esam -> Esam -> Bool
$c== :: Esam -> Esam -> Bool
Prelude.Eq, ReadPrec [Esam]
ReadPrec Esam
Int -> ReadS Esam
ReadS [Esam]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Esam]
$creadListPrec :: ReadPrec [Esam]
readPrec :: ReadPrec Esam
$creadPrec :: ReadPrec Esam
readList :: ReadS [Esam]
$creadList :: ReadS [Esam]
readsPrec :: Int -> ReadS Esam
$creadsPrec :: Int -> ReadS Esam
Prelude.Read, Int -> Esam -> ShowS
[Esam] -> ShowS
Esam -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Esam] -> ShowS
$cshowList :: [Esam] -> ShowS
show :: Esam -> String
$cshow :: Esam -> String
showsPrec :: Int -> Esam -> ShowS
$cshowsPrec :: Int -> Esam -> ShowS
Prelude.Show, forall x. Rep Esam x -> Esam
forall x. Esam -> Rep Esam x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Esam x -> Esam
$cfrom :: forall x. Esam -> Rep Esam x
Prelude.Generic)

-- |
-- Create a value of 'Esam' 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:
--
-- 'adAvailOffset', 'esam_adAvailOffset' - When specified, this offset (in milliseconds) is added to the input Ad
-- Avail PTS time. This only applies to embedded SCTE 104\/35 messages and
-- does not apply to OOB messages.
--
-- 'passwordParam', 'esam_passwordParam' - Documentation update needed
--
-- 'username', 'esam_username' - Documentation update needed
--
-- 'zoneIdentity', 'esam_zoneIdentity' - Optional data sent as zoneIdentity to identify the MediaLive channel to
-- the POIS.
--
-- 'acquisitionPointId', 'esam_acquisitionPointId' - Sent as acquisitionPointIdentity to identify the MediaLive channel to
-- the POIS.
--
-- 'poisEndpoint', 'esam_poisEndpoint' - The URL of the signal conditioner endpoint on the Placement Opportunity
-- Information System (POIS). MediaLive sends SignalProcessingEvents here
-- when SCTE-35 messages are read.
newEsam ::
  -- | 'acquisitionPointId'
  Prelude.Text ->
  -- | 'poisEndpoint'
  Prelude.Text ->
  Esam
newEsam :: Text -> Text -> Esam
newEsam Text
pAcquisitionPointId_ Text
pPoisEndpoint_ =
  Esam'
    { $sel:adAvailOffset:Esam' :: Maybe Int
adAvailOffset = forall a. Maybe a
Prelude.Nothing,
      $sel:passwordParam:Esam' :: Maybe Text
passwordParam = forall a. Maybe a
Prelude.Nothing,
      $sel:username:Esam' :: Maybe Text
username = forall a. Maybe a
Prelude.Nothing,
      $sel:zoneIdentity:Esam' :: Maybe Text
zoneIdentity = forall a. Maybe a
Prelude.Nothing,
      $sel:acquisitionPointId:Esam' :: Text
acquisitionPointId = Text
pAcquisitionPointId_,
      $sel:poisEndpoint:Esam' :: Text
poisEndpoint = Text
pPoisEndpoint_
    }

-- | When specified, this offset (in milliseconds) is added to the input Ad
-- Avail PTS time. This only applies to embedded SCTE 104\/35 messages and
-- does not apply to OOB messages.
esam_adAvailOffset :: Lens.Lens' Esam (Prelude.Maybe Prelude.Int)
esam_adAvailOffset :: Lens' Esam (Maybe Int)
esam_adAvailOffset = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Esam' {Maybe Int
adAvailOffset :: Maybe Int
$sel:adAvailOffset:Esam' :: Esam -> Maybe Int
adAvailOffset} -> Maybe Int
adAvailOffset) (\s :: Esam
s@Esam' {} Maybe Int
a -> Esam
s {$sel:adAvailOffset:Esam' :: Maybe Int
adAvailOffset = Maybe Int
a} :: Esam)

-- | Documentation update needed
esam_passwordParam :: Lens.Lens' Esam (Prelude.Maybe Prelude.Text)
esam_passwordParam :: Lens' Esam (Maybe Text)
esam_passwordParam = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Esam' {Maybe Text
passwordParam :: Maybe Text
$sel:passwordParam:Esam' :: Esam -> Maybe Text
passwordParam} -> Maybe Text
passwordParam) (\s :: Esam
s@Esam' {} Maybe Text
a -> Esam
s {$sel:passwordParam:Esam' :: Maybe Text
passwordParam = Maybe Text
a} :: Esam)

-- | Documentation update needed
esam_username :: Lens.Lens' Esam (Prelude.Maybe Prelude.Text)
esam_username :: Lens' Esam (Maybe Text)
esam_username = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Esam' {Maybe Text
username :: Maybe Text
$sel:username:Esam' :: Esam -> Maybe Text
username} -> Maybe Text
username) (\s :: Esam
s@Esam' {} Maybe Text
a -> Esam
s {$sel:username:Esam' :: Maybe Text
username = Maybe Text
a} :: Esam)

-- | Optional data sent as zoneIdentity to identify the MediaLive channel to
-- the POIS.
esam_zoneIdentity :: Lens.Lens' Esam (Prelude.Maybe Prelude.Text)
esam_zoneIdentity :: Lens' Esam (Maybe Text)
esam_zoneIdentity = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Esam' {Maybe Text
zoneIdentity :: Maybe Text
$sel:zoneIdentity:Esam' :: Esam -> Maybe Text
zoneIdentity} -> Maybe Text
zoneIdentity) (\s :: Esam
s@Esam' {} Maybe Text
a -> Esam
s {$sel:zoneIdentity:Esam' :: Maybe Text
zoneIdentity = Maybe Text
a} :: Esam)

-- | Sent as acquisitionPointIdentity to identify the MediaLive channel to
-- the POIS.
esam_acquisitionPointId :: Lens.Lens' Esam Prelude.Text
esam_acquisitionPointId :: Lens' Esam Text
esam_acquisitionPointId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Esam' {Text
acquisitionPointId :: Text
$sel:acquisitionPointId:Esam' :: Esam -> Text
acquisitionPointId} -> Text
acquisitionPointId) (\s :: Esam
s@Esam' {} Text
a -> Esam
s {$sel:acquisitionPointId:Esam' :: Text
acquisitionPointId = Text
a} :: Esam)

-- | The URL of the signal conditioner endpoint on the Placement Opportunity
-- Information System (POIS). MediaLive sends SignalProcessingEvents here
-- when SCTE-35 messages are read.
esam_poisEndpoint :: Lens.Lens' Esam Prelude.Text
esam_poisEndpoint :: Lens' Esam Text
esam_poisEndpoint = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Esam' {Text
poisEndpoint :: Text
$sel:poisEndpoint:Esam' :: Esam -> Text
poisEndpoint} -> Text
poisEndpoint) (\s :: Esam
s@Esam' {} Text
a -> Esam
s {$sel:poisEndpoint:Esam' :: Text
poisEndpoint = Text
a} :: Esam)

instance Data.FromJSON Esam where
  parseJSON :: Value -> Parser Esam
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Esam"
      ( \Object
x ->
          Maybe Int
-> Maybe Text -> Maybe Text -> Maybe Text -> Text -> Text -> Esam
Esam'
            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
"adAvailOffset")
            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
"passwordParam")
            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
"username")
            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
"zoneIdentity")
            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
"acquisitionPointId")
            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
"poisEndpoint")
      )

instance Prelude.Hashable Esam where
  hashWithSalt :: Int -> Esam -> Int
hashWithSalt Int
_salt Esam' {Maybe Int
Maybe Text
Text
poisEndpoint :: Text
acquisitionPointId :: Text
zoneIdentity :: Maybe Text
username :: Maybe Text
passwordParam :: Maybe Text
adAvailOffset :: Maybe Int
$sel:poisEndpoint:Esam' :: Esam -> Text
$sel:acquisitionPointId:Esam' :: Esam -> Text
$sel:zoneIdentity:Esam' :: Esam -> Maybe Text
$sel:username:Esam' :: Esam -> Maybe Text
$sel:passwordParam:Esam' :: Esam -> Maybe Text
$sel:adAvailOffset:Esam' :: Esam -> Maybe Int
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
adAvailOffset
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
passwordParam
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
username
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
zoneIdentity
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
acquisitionPointId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
poisEndpoint

instance Prelude.NFData Esam where
  rnf :: Esam -> ()
rnf Esam' {Maybe Int
Maybe Text
Text
poisEndpoint :: Text
acquisitionPointId :: Text
zoneIdentity :: Maybe Text
username :: Maybe Text
passwordParam :: Maybe Text
adAvailOffset :: Maybe Int
$sel:poisEndpoint:Esam' :: Esam -> Text
$sel:acquisitionPointId:Esam' :: Esam -> Text
$sel:zoneIdentity:Esam' :: Esam -> Maybe Text
$sel:username:Esam' :: Esam -> Maybe Text
$sel:passwordParam:Esam' :: Esam -> Maybe Text
$sel:adAvailOffset:Esam' :: Esam -> Maybe Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
adAvailOffset
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
passwordParam
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
username
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
zoneIdentity
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
acquisitionPointId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
poisEndpoint

instance Data.ToJSON Esam where
  toJSON :: Esam -> Value
toJSON Esam' {Maybe Int
Maybe Text
Text
poisEndpoint :: Text
acquisitionPointId :: Text
zoneIdentity :: Maybe Text
username :: Maybe Text
passwordParam :: Maybe Text
adAvailOffset :: Maybe Int
$sel:poisEndpoint:Esam' :: Esam -> Text
$sel:acquisitionPointId:Esam' :: Esam -> Text
$sel:zoneIdentity:Esam' :: Esam -> Maybe Text
$sel:username:Esam' :: Esam -> Maybe Text
$sel:passwordParam:Esam' :: Esam -> Maybe Text
$sel:adAvailOffset:Esam' :: Esam -> Maybe Int
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"adAvailOffset" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
adAvailOffset,
            (Key
"passwordParam" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
passwordParam,
            (Key
"username" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
username,
            (Key
"zoneIdentity" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
zoneIdentity,
            forall a. a -> Maybe a
Prelude.Just
              (Key
"acquisitionPointId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
acquisitionPointId),
            forall a. a -> Maybe a
Prelude.Just (Key
"poisEndpoint" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
poisEndpoint)
          ]
      )