{-# 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.Rekognition.Types.KinesisVideoStreamStartSelector
-- 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.Rekognition.Types.KinesisVideoStreamStartSelector 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

-- | Specifies the starting point in a Kinesis stream to start processing.
-- You can use the producer timestamp or the fragment number. One of either
-- producer timestamp or fragment number is required. If you use the
-- producer timestamp, you must put the time in milliseconds. For more
-- information about fragment numbers, see
-- <https://docs.aws.amazon.com/kinesisvideostreams/latest/dg/API_reader_Fragment.html Fragment>.
--
-- /See:/ 'newKinesisVideoStreamStartSelector' smart constructor.
data KinesisVideoStreamStartSelector = KinesisVideoStreamStartSelector'
  { -- | The unique identifier of the fragment. This value monotonically
    -- increases based on the ingestion order.
    KinesisVideoStreamStartSelector -> Maybe Text
fragmentNumber :: Prelude.Maybe Prelude.Text,
    -- | The timestamp from the producer corresponding to the fragment, in
    -- milliseconds, expressed in unix time format.
    KinesisVideoStreamStartSelector -> Maybe Natural
producerTimestamp :: Prelude.Maybe Prelude.Natural
  }
  deriving (KinesisVideoStreamStartSelector
-> KinesisVideoStreamStartSelector -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: KinesisVideoStreamStartSelector
-> KinesisVideoStreamStartSelector -> Bool
$c/= :: KinesisVideoStreamStartSelector
-> KinesisVideoStreamStartSelector -> Bool
== :: KinesisVideoStreamStartSelector
-> KinesisVideoStreamStartSelector -> Bool
$c== :: KinesisVideoStreamStartSelector
-> KinesisVideoStreamStartSelector -> Bool
Prelude.Eq, ReadPrec [KinesisVideoStreamStartSelector]
ReadPrec KinesisVideoStreamStartSelector
Int -> ReadS KinesisVideoStreamStartSelector
ReadS [KinesisVideoStreamStartSelector]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [KinesisVideoStreamStartSelector]
$creadListPrec :: ReadPrec [KinesisVideoStreamStartSelector]
readPrec :: ReadPrec KinesisVideoStreamStartSelector
$creadPrec :: ReadPrec KinesisVideoStreamStartSelector
readList :: ReadS [KinesisVideoStreamStartSelector]
$creadList :: ReadS [KinesisVideoStreamStartSelector]
readsPrec :: Int -> ReadS KinesisVideoStreamStartSelector
$creadsPrec :: Int -> ReadS KinesisVideoStreamStartSelector
Prelude.Read, Int -> KinesisVideoStreamStartSelector -> ShowS
[KinesisVideoStreamStartSelector] -> ShowS
KinesisVideoStreamStartSelector -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [KinesisVideoStreamStartSelector] -> ShowS
$cshowList :: [KinesisVideoStreamStartSelector] -> ShowS
show :: KinesisVideoStreamStartSelector -> String
$cshow :: KinesisVideoStreamStartSelector -> String
showsPrec :: Int -> KinesisVideoStreamStartSelector -> ShowS
$cshowsPrec :: Int -> KinesisVideoStreamStartSelector -> ShowS
Prelude.Show, forall x.
Rep KinesisVideoStreamStartSelector x
-> KinesisVideoStreamStartSelector
forall x.
KinesisVideoStreamStartSelector
-> Rep KinesisVideoStreamStartSelector x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep KinesisVideoStreamStartSelector x
-> KinesisVideoStreamStartSelector
$cfrom :: forall x.
KinesisVideoStreamStartSelector
-> Rep KinesisVideoStreamStartSelector x
Prelude.Generic)

-- |
-- Create a value of 'KinesisVideoStreamStartSelector' 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:
--
-- 'fragmentNumber', 'kinesisVideoStreamStartSelector_fragmentNumber' - The unique identifier of the fragment. This value monotonically
-- increases based on the ingestion order.
--
-- 'producerTimestamp', 'kinesisVideoStreamStartSelector_producerTimestamp' - The timestamp from the producer corresponding to the fragment, in
-- milliseconds, expressed in unix time format.
newKinesisVideoStreamStartSelector ::
  KinesisVideoStreamStartSelector
newKinesisVideoStreamStartSelector :: KinesisVideoStreamStartSelector
newKinesisVideoStreamStartSelector =
  KinesisVideoStreamStartSelector'
    { $sel:fragmentNumber:KinesisVideoStreamStartSelector' :: Maybe Text
fragmentNumber =
        forall a. Maybe a
Prelude.Nothing,
      $sel:producerTimestamp:KinesisVideoStreamStartSelector' :: Maybe Natural
producerTimestamp = forall a. Maybe a
Prelude.Nothing
    }

-- | The unique identifier of the fragment. This value monotonically
-- increases based on the ingestion order.
kinesisVideoStreamStartSelector_fragmentNumber :: Lens.Lens' KinesisVideoStreamStartSelector (Prelude.Maybe Prelude.Text)
kinesisVideoStreamStartSelector_fragmentNumber :: Lens' KinesisVideoStreamStartSelector (Maybe Text)
kinesisVideoStreamStartSelector_fragmentNumber = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KinesisVideoStreamStartSelector' {Maybe Text
fragmentNumber :: Maybe Text
$sel:fragmentNumber:KinesisVideoStreamStartSelector' :: KinesisVideoStreamStartSelector -> Maybe Text
fragmentNumber} -> Maybe Text
fragmentNumber) (\s :: KinesisVideoStreamStartSelector
s@KinesisVideoStreamStartSelector' {} Maybe Text
a -> KinesisVideoStreamStartSelector
s {$sel:fragmentNumber:KinesisVideoStreamStartSelector' :: Maybe Text
fragmentNumber = Maybe Text
a} :: KinesisVideoStreamStartSelector)

-- | The timestamp from the producer corresponding to the fragment, in
-- milliseconds, expressed in unix time format.
kinesisVideoStreamStartSelector_producerTimestamp :: Lens.Lens' KinesisVideoStreamStartSelector (Prelude.Maybe Prelude.Natural)
kinesisVideoStreamStartSelector_producerTimestamp :: Lens' KinesisVideoStreamStartSelector (Maybe Natural)
kinesisVideoStreamStartSelector_producerTimestamp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KinesisVideoStreamStartSelector' {Maybe Natural
producerTimestamp :: Maybe Natural
$sel:producerTimestamp:KinesisVideoStreamStartSelector' :: KinesisVideoStreamStartSelector -> Maybe Natural
producerTimestamp} -> Maybe Natural
producerTimestamp) (\s :: KinesisVideoStreamStartSelector
s@KinesisVideoStreamStartSelector' {} Maybe Natural
a -> KinesisVideoStreamStartSelector
s {$sel:producerTimestamp:KinesisVideoStreamStartSelector' :: Maybe Natural
producerTimestamp = Maybe Natural
a} :: KinesisVideoStreamStartSelector)

instance
  Prelude.Hashable
    KinesisVideoStreamStartSelector
  where
  hashWithSalt :: Int -> KinesisVideoStreamStartSelector -> Int
hashWithSalt
    Int
_salt
    KinesisVideoStreamStartSelector' {Maybe Natural
Maybe Text
producerTimestamp :: Maybe Natural
fragmentNumber :: Maybe Text
$sel:producerTimestamp:KinesisVideoStreamStartSelector' :: KinesisVideoStreamStartSelector -> Maybe Natural
$sel:fragmentNumber:KinesisVideoStreamStartSelector' :: KinesisVideoStreamStartSelector -> Maybe Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
fragmentNumber
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
producerTimestamp

instance
  Prelude.NFData
    KinesisVideoStreamStartSelector
  where
  rnf :: KinesisVideoStreamStartSelector -> ()
rnf KinesisVideoStreamStartSelector' {Maybe Natural
Maybe Text
producerTimestamp :: Maybe Natural
fragmentNumber :: Maybe Text
$sel:producerTimestamp:KinesisVideoStreamStartSelector' :: KinesisVideoStreamStartSelector -> Maybe Natural
$sel:fragmentNumber:KinesisVideoStreamStartSelector' :: KinesisVideoStreamStartSelector -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
fragmentNumber
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
producerTimestamp

instance Data.ToJSON KinesisVideoStreamStartSelector where
  toJSON :: KinesisVideoStreamStartSelector -> Value
toJSON KinesisVideoStreamStartSelector' {Maybe Natural
Maybe Text
producerTimestamp :: Maybe Natural
fragmentNumber :: Maybe Text
$sel:producerTimestamp:KinesisVideoStreamStartSelector' :: KinesisVideoStreamStartSelector -> Maybe Natural
$sel:fragmentNumber:KinesisVideoStreamStartSelector' :: KinesisVideoStreamStartSelector -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"FragmentNumber" 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
fragmentNumber,
            (Key
"ProducerTimestamp" 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 Natural
producerTimestamp
          ]
      )