{-# 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.IVS.Types.StreamSessionSummary
-- 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.IVS.Types.StreamSessionSummary 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

-- | Summary information about a stream session.
--
-- /See:/ 'newStreamSessionSummary' smart constructor.
data StreamSessionSummary = StreamSessionSummary'
  { -- | Time when the channel went offline. This is an ISO 8601 timestamp; /note
    -- that this is returned as a string/. For live streams, this is @NULL@.
    StreamSessionSummary -> Maybe ISO8601
endTime :: Prelude.Maybe Data.ISO8601,
    -- | If @true@, this stream encountered a quota breach or failure.
    StreamSessionSummary -> Maybe Bool
hasErrorEvent :: Prelude.Maybe Prelude.Bool,
    -- | Time when the channel went live. This is an ISO 8601 timestamp; /note
    -- that this is returned as a string/.
    StreamSessionSummary -> Maybe ISO8601
startTime :: Prelude.Maybe Data.ISO8601,
    -- | Unique identifier for a live or previously live stream in the specified
    -- channel.
    StreamSessionSummary -> Maybe Text
streamId :: Prelude.Maybe Prelude.Text
  }
  deriving (StreamSessionSummary -> StreamSessionSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StreamSessionSummary -> StreamSessionSummary -> Bool
$c/= :: StreamSessionSummary -> StreamSessionSummary -> Bool
== :: StreamSessionSummary -> StreamSessionSummary -> Bool
$c== :: StreamSessionSummary -> StreamSessionSummary -> Bool
Prelude.Eq, ReadPrec [StreamSessionSummary]
ReadPrec StreamSessionSummary
Int -> ReadS StreamSessionSummary
ReadS [StreamSessionSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StreamSessionSummary]
$creadListPrec :: ReadPrec [StreamSessionSummary]
readPrec :: ReadPrec StreamSessionSummary
$creadPrec :: ReadPrec StreamSessionSummary
readList :: ReadS [StreamSessionSummary]
$creadList :: ReadS [StreamSessionSummary]
readsPrec :: Int -> ReadS StreamSessionSummary
$creadsPrec :: Int -> ReadS StreamSessionSummary
Prelude.Read, Int -> StreamSessionSummary -> ShowS
[StreamSessionSummary] -> ShowS
StreamSessionSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StreamSessionSummary] -> ShowS
$cshowList :: [StreamSessionSummary] -> ShowS
show :: StreamSessionSummary -> String
$cshow :: StreamSessionSummary -> String
showsPrec :: Int -> StreamSessionSummary -> ShowS
$cshowsPrec :: Int -> StreamSessionSummary -> ShowS
Prelude.Show, forall x. Rep StreamSessionSummary x -> StreamSessionSummary
forall x. StreamSessionSummary -> Rep StreamSessionSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StreamSessionSummary x -> StreamSessionSummary
$cfrom :: forall x. StreamSessionSummary -> Rep StreamSessionSummary x
Prelude.Generic)

-- |
-- Create a value of 'StreamSessionSummary' 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:
--
-- 'endTime', 'streamSessionSummary_endTime' - Time when the channel went offline. This is an ISO 8601 timestamp; /note
-- that this is returned as a string/. For live streams, this is @NULL@.
--
-- 'hasErrorEvent', 'streamSessionSummary_hasErrorEvent' - If @true@, this stream encountered a quota breach or failure.
--
-- 'startTime', 'streamSessionSummary_startTime' - Time when the channel went live. This is an ISO 8601 timestamp; /note
-- that this is returned as a string/.
--
-- 'streamId', 'streamSessionSummary_streamId' - Unique identifier for a live or previously live stream in the specified
-- channel.
newStreamSessionSummary ::
  StreamSessionSummary
newStreamSessionSummary :: StreamSessionSummary
newStreamSessionSummary =
  StreamSessionSummary'
    { $sel:endTime:StreamSessionSummary' :: Maybe ISO8601
endTime = forall a. Maybe a
Prelude.Nothing,
      $sel:hasErrorEvent:StreamSessionSummary' :: Maybe Bool
hasErrorEvent = forall a. Maybe a
Prelude.Nothing,
      $sel:startTime:StreamSessionSummary' :: Maybe ISO8601
startTime = forall a. Maybe a
Prelude.Nothing,
      $sel:streamId:StreamSessionSummary' :: Maybe Text
streamId = forall a. Maybe a
Prelude.Nothing
    }

-- | Time when the channel went offline. This is an ISO 8601 timestamp; /note
-- that this is returned as a string/. For live streams, this is @NULL@.
streamSessionSummary_endTime :: Lens.Lens' StreamSessionSummary (Prelude.Maybe Prelude.UTCTime)
streamSessionSummary_endTime :: Lens' StreamSessionSummary (Maybe UTCTime)
streamSessionSummary_endTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamSessionSummary' {Maybe ISO8601
endTime :: Maybe ISO8601
$sel:endTime:StreamSessionSummary' :: StreamSessionSummary -> Maybe ISO8601
endTime} -> Maybe ISO8601
endTime) (\s :: StreamSessionSummary
s@StreamSessionSummary' {} Maybe ISO8601
a -> StreamSessionSummary
s {$sel:endTime:StreamSessionSummary' :: Maybe ISO8601
endTime = Maybe ISO8601
a} :: StreamSessionSummary) 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

-- | If @true@, this stream encountered a quota breach or failure.
streamSessionSummary_hasErrorEvent :: Lens.Lens' StreamSessionSummary (Prelude.Maybe Prelude.Bool)
streamSessionSummary_hasErrorEvent :: Lens' StreamSessionSummary (Maybe Bool)
streamSessionSummary_hasErrorEvent = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamSessionSummary' {Maybe Bool
hasErrorEvent :: Maybe Bool
$sel:hasErrorEvent:StreamSessionSummary' :: StreamSessionSummary -> Maybe Bool
hasErrorEvent} -> Maybe Bool
hasErrorEvent) (\s :: StreamSessionSummary
s@StreamSessionSummary' {} Maybe Bool
a -> StreamSessionSummary
s {$sel:hasErrorEvent:StreamSessionSummary' :: Maybe Bool
hasErrorEvent = Maybe Bool
a} :: StreamSessionSummary)

-- | Time when the channel went live. This is an ISO 8601 timestamp; /note
-- that this is returned as a string/.
streamSessionSummary_startTime :: Lens.Lens' StreamSessionSummary (Prelude.Maybe Prelude.UTCTime)
streamSessionSummary_startTime :: Lens' StreamSessionSummary (Maybe UTCTime)
streamSessionSummary_startTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamSessionSummary' {Maybe ISO8601
startTime :: Maybe ISO8601
$sel:startTime:StreamSessionSummary' :: StreamSessionSummary -> Maybe ISO8601
startTime} -> Maybe ISO8601
startTime) (\s :: StreamSessionSummary
s@StreamSessionSummary' {} Maybe ISO8601
a -> StreamSessionSummary
s {$sel:startTime:StreamSessionSummary' :: Maybe ISO8601
startTime = Maybe ISO8601
a} :: StreamSessionSummary) 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

-- | Unique identifier for a live or previously live stream in the specified
-- channel.
streamSessionSummary_streamId :: Lens.Lens' StreamSessionSummary (Prelude.Maybe Prelude.Text)
streamSessionSummary_streamId :: Lens' StreamSessionSummary (Maybe Text)
streamSessionSummary_streamId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamSessionSummary' {Maybe Text
streamId :: Maybe Text
$sel:streamId:StreamSessionSummary' :: StreamSessionSummary -> Maybe Text
streamId} -> Maybe Text
streamId) (\s :: StreamSessionSummary
s@StreamSessionSummary' {} Maybe Text
a -> StreamSessionSummary
s {$sel:streamId:StreamSessionSummary' :: Maybe Text
streamId = Maybe Text
a} :: StreamSessionSummary)

instance Data.FromJSON StreamSessionSummary where
  parseJSON :: Value -> Parser StreamSessionSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"StreamSessionSummary"
      ( \Object
x ->
          Maybe ISO8601
-> Maybe Bool
-> Maybe ISO8601
-> Maybe Text
-> StreamSessionSummary
StreamSessionSummary'
            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
"endTime")
            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
"hasErrorEvent")
            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
"startTime")
            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
"streamId")
      )

instance Prelude.Hashable StreamSessionSummary where
  hashWithSalt :: Int -> StreamSessionSummary -> Int
hashWithSalt Int
_salt StreamSessionSummary' {Maybe Bool
Maybe Text
Maybe ISO8601
streamId :: Maybe Text
startTime :: Maybe ISO8601
hasErrorEvent :: Maybe Bool
endTime :: Maybe ISO8601
$sel:streamId:StreamSessionSummary' :: StreamSessionSummary -> Maybe Text
$sel:startTime:StreamSessionSummary' :: StreamSessionSummary -> Maybe ISO8601
$sel:hasErrorEvent:StreamSessionSummary' :: StreamSessionSummary -> Maybe Bool
$sel:endTime:StreamSessionSummary' :: StreamSessionSummary -> Maybe ISO8601
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ISO8601
endTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
hasErrorEvent
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ISO8601
startTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
streamId

instance Prelude.NFData StreamSessionSummary where
  rnf :: StreamSessionSummary -> ()
rnf StreamSessionSummary' {Maybe Bool
Maybe Text
Maybe ISO8601
streamId :: Maybe Text
startTime :: Maybe ISO8601
hasErrorEvent :: Maybe Bool
endTime :: Maybe ISO8601
$sel:streamId:StreamSessionSummary' :: StreamSessionSummary -> Maybe Text
$sel:startTime:StreamSessionSummary' :: StreamSessionSummary -> Maybe ISO8601
$sel:hasErrorEvent:StreamSessionSummary' :: StreamSessionSummary -> Maybe Bool
$sel:endTime:StreamSessionSummary' :: StreamSessionSummary -> Maybe ISO8601
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ISO8601
endTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
hasErrorEvent
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ISO8601
startTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
streamId