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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Rekognition.Types.SegmentType
import Amazonka.Rekognition.Types.ShotSegment
import Amazonka.Rekognition.Types.TechnicalCueSegment

-- | A technical cue or shot detection segment detected in a video. An array
-- of @SegmentDetection@ objects containing all segments detected in a
-- stored video is returned by GetSegmentDetection.
--
-- /See:/ 'newSegmentDetection' smart constructor.
data SegmentDetection = SegmentDetection'
  { -- | If the segment is a technical cue, contains information about the
    -- technical cue.
    SegmentDetection -> Maybe TechnicalCueSegment
technicalCueSegment :: Prelude.Maybe TechnicalCueSegment,
    -- | The frame number at the end of a video segment, using a frame index that
    -- starts with 0.
    SegmentDetection -> Maybe Natural
endFrameNumber :: Prelude.Maybe Prelude.Natural,
    -- | The duration of the timecode for the detected segment in SMPTE format.
    SegmentDetection -> Maybe Text
durationSMPTE :: Prelude.Maybe Prelude.Text,
    -- | The end time of the detected segment, in milliseconds, from the start of
    -- the video. This value is rounded down.
    SegmentDetection -> Maybe Integer
endTimestampMillis :: Prelude.Maybe Prelude.Integer,
    -- | The frame-accurate SMPTE timecode, from the start of a video, for the
    -- start of a detected segment. @StartTimecode@ is in /HH:MM:SS:fr/ format
    -- (and /;fr/ for drop frame-rates).
    SegmentDetection -> Maybe Text
startTimecodeSMPTE :: Prelude.Maybe Prelude.Text,
    -- | The frame-accurate SMPTE timecode, from the start of a video, for the
    -- end of a detected segment. @EndTimecode@ is in /HH:MM:SS:fr/ format (and
    -- /;fr/ for drop frame-rates).
    SegmentDetection -> Maybe Text
endTimecodeSMPTE :: Prelude.Maybe Prelude.Text,
    -- | The duration of the detected segment in milliseconds.
    SegmentDetection -> Maybe Natural
durationMillis :: Prelude.Maybe Prelude.Natural,
    -- | The duration of a video segment, expressed in frames.
    SegmentDetection -> Maybe Natural
durationFrames :: Prelude.Maybe Prelude.Natural,
    -- | The start time of the detected segment in milliseconds from the start of
    -- the video. This value is rounded down. For example, if the actual
    -- timestamp is 100.6667 milliseconds, Amazon Rekognition Video returns a
    -- value of 100 millis.
    SegmentDetection -> Maybe Integer
startTimestampMillis :: Prelude.Maybe Prelude.Integer,
    -- | The type of the segment. Valid values are @TECHNICAL_CUE@ and @SHOT@.
    SegmentDetection -> Maybe SegmentType
type' :: Prelude.Maybe SegmentType,
    -- | If the segment is a shot detection, contains information about the shot
    -- detection.
    SegmentDetection -> Maybe ShotSegment
shotSegment :: Prelude.Maybe ShotSegment,
    -- | The frame number of the start of a video segment, using a frame index
    -- that starts with 0.
    SegmentDetection -> Maybe Natural
startFrameNumber :: Prelude.Maybe Prelude.Natural
  }
  deriving (SegmentDetection -> SegmentDetection -> Bool
(SegmentDetection -> SegmentDetection -> Bool)
-> (SegmentDetection -> SegmentDetection -> Bool)
-> Eq SegmentDetection
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SegmentDetection -> SegmentDetection -> Bool
$c/= :: SegmentDetection -> SegmentDetection -> Bool
== :: SegmentDetection -> SegmentDetection -> Bool
$c== :: SegmentDetection -> SegmentDetection -> Bool
Prelude.Eq, ReadPrec [SegmentDetection]
ReadPrec SegmentDetection
Int -> ReadS SegmentDetection
ReadS [SegmentDetection]
(Int -> ReadS SegmentDetection)
-> ReadS [SegmentDetection]
-> ReadPrec SegmentDetection
-> ReadPrec [SegmentDetection]
-> Read SegmentDetection
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SegmentDetection]
$creadListPrec :: ReadPrec [SegmentDetection]
readPrec :: ReadPrec SegmentDetection
$creadPrec :: ReadPrec SegmentDetection
readList :: ReadS [SegmentDetection]
$creadList :: ReadS [SegmentDetection]
readsPrec :: Int -> ReadS SegmentDetection
$creadsPrec :: Int -> ReadS SegmentDetection
Prelude.Read, Int -> SegmentDetection -> ShowS
[SegmentDetection] -> ShowS
SegmentDetection -> String
(Int -> SegmentDetection -> ShowS)
-> (SegmentDetection -> String)
-> ([SegmentDetection] -> ShowS)
-> Show SegmentDetection
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SegmentDetection] -> ShowS
$cshowList :: [SegmentDetection] -> ShowS
show :: SegmentDetection -> String
$cshow :: SegmentDetection -> String
showsPrec :: Int -> SegmentDetection -> ShowS
$cshowsPrec :: Int -> SegmentDetection -> ShowS
Prelude.Show, (forall x. SegmentDetection -> Rep SegmentDetection x)
-> (forall x. Rep SegmentDetection x -> SegmentDetection)
-> Generic SegmentDetection
forall x. Rep SegmentDetection x -> SegmentDetection
forall x. SegmentDetection -> Rep SegmentDetection x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SegmentDetection x -> SegmentDetection
$cfrom :: forall x. SegmentDetection -> Rep SegmentDetection x
Prelude.Generic)

-- |
-- Create a value of 'SegmentDetection' 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:
--
-- 'technicalCueSegment', 'segmentDetection_technicalCueSegment' - If the segment is a technical cue, contains information about the
-- technical cue.
--
-- 'endFrameNumber', 'segmentDetection_endFrameNumber' - The frame number at the end of a video segment, using a frame index that
-- starts with 0.
--
-- 'durationSMPTE', 'segmentDetection_durationSMPTE' - The duration of the timecode for the detected segment in SMPTE format.
--
-- 'endTimestampMillis', 'segmentDetection_endTimestampMillis' - The end time of the detected segment, in milliseconds, from the start of
-- the video. This value is rounded down.
--
-- 'startTimecodeSMPTE', 'segmentDetection_startTimecodeSMPTE' - The frame-accurate SMPTE timecode, from the start of a video, for the
-- start of a detected segment. @StartTimecode@ is in /HH:MM:SS:fr/ format
-- (and /;fr/ for drop frame-rates).
--
-- 'endTimecodeSMPTE', 'segmentDetection_endTimecodeSMPTE' - The frame-accurate SMPTE timecode, from the start of a video, for the
-- end of a detected segment. @EndTimecode@ is in /HH:MM:SS:fr/ format (and
-- /;fr/ for drop frame-rates).
--
-- 'durationMillis', 'segmentDetection_durationMillis' - The duration of the detected segment in milliseconds.
--
-- 'durationFrames', 'segmentDetection_durationFrames' - The duration of a video segment, expressed in frames.
--
-- 'startTimestampMillis', 'segmentDetection_startTimestampMillis' - The start time of the detected segment in milliseconds from the start of
-- the video. This value is rounded down. For example, if the actual
-- timestamp is 100.6667 milliseconds, Amazon Rekognition Video returns a
-- value of 100 millis.
--
-- 'type'', 'segmentDetection_type' - The type of the segment. Valid values are @TECHNICAL_CUE@ and @SHOT@.
--
-- 'shotSegment', 'segmentDetection_shotSegment' - If the segment is a shot detection, contains information about the shot
-- detection.
--
-- 'startFrameNumber', 'segmentDetection_startFrameNumber' - The frame number of the start of a video segment, using a frame index
-- that starts with 0.
newSegmentDetection ::
  SegmentDetection
newSegmentDetection :: SegmentDetection
newSegmentDetection =
  SegmentDetection' :: Maybe TechnicalCueSegment
-> Maybe Natural
-> Maybe Text
-> Maybe Integer
-> Maybe Text
-> Maybe Text
-> Maybe Natural
-> Maybe Natural
-> Maybe Integer
-> Maybe SegmentType
-> Maybe ShotSegment
-> Maybe Natural
-> SegmentDetection
SegmentDetection'
    { $sel:technicalCueSegment:SegmentDetection' :: Maybe TechnicalCueSegment
technicalCueSegment =
        Maybe TechnicalCueSegment
forall a. Maybe a
Prelude.Nothing,
      $sel:endFrameNumber:SegmentDetection' :: Maybe Natural
endFrameNumber = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:durationSMPTE:SegmentDetection' :: Maybe Text
durationSMPTE = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:endTimestampMillis:SegmentDetection' :: Maybe Integer
endTimestampMillis = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:startTimecodeSMPTE:SegmentDetection' :: Maybe Text
startTimecodeSMPTE = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:endTimecodeSMPTE:SegmentDetection' :: Maybe Text
endTimecodeSMPTE = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:durationMillis:SegmentDetection' :: Maybe Natural
durationMillis = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:durationFrames:SegmentDetection' :: Maybe Natural
durationFrames = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:startTimestampMillis:SegmentDetection' :: Maybe Integer
startTimestampMillis = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:type':SegmentDetection' :: Maybe SegmentType
type' = Maybe SegmentType
forall a. Maybe a
Prelude.Nothing,
      $sel:shotSegment:SegmentDetection' :: Maybe ShotSegment
shotSegment = Maybe ShotSegment
forall a. Maybe a
Prelude.Nothing,
      $sel:startFrameNumber:SegmentDetection' :: Maybe Natural
startFrameNumber = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | If the segment is a technical cue, contains information about the
-- technical cue.
segmentDetection_technicalCueSegment :: Lens.Lens' SegmentDetection (Prelude.Maybe TechnicalCueSegment)
segmentDetection_technicalCueSegment :: (Maybe TechnicalCueSegment -> f (Maybe TechnicalCueSegment))
-> SegmentDetection -> f SegmentDetection
segmentDetection_technicalCueSegment = (SegmentDetection -> Maybe TechnicalCueSegment)
-> (SegmentDetection
    -> Maybe TechnicalCueSegment -> SegmentDetection)
-> Lens
     SegmentDetection
     SegmentDetection
     (Maybe TechnicalCueSegment)
     (Maybe TechnicalCueSegment)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SegmentDetection' {Maybe TechnicalCueSegment
technicalCueSegment :: Maybe TechnicalCueSegment
$sel:technicalCueSegment:SegmentDetection' :: SegmentDetection -> Maybe TechnicalCueSegment
technicalCueSegment} -> Maybe TechnicalCueSegment
technicalCueSegment) (\s :: SegmentDetection
s@SegmentDetection' {} Maybe TechnicalCueSegment
a -> SegmentDetection
s {$sel:technicalCueSegment:SegmentDetection' :: Maybe TechnicalCueSegment
technicalCueSegment = Maybe TechnicalCueSegment
a} :: SegmentDetection)

-- | The frame number at the end of a video segment, using a frame index that
-- starts with 0.
segmentDetection_endFrameNumber :: Lens.Lens' SegmentDetection (Prelude.Maybe Prelude.Natural)
segmentDetection_endFrameNumber :: (Maybe Natural -> f (Maybe Natural))
-> SegmentDetection -> f SegmentDetection
segmentDetection_endFrameNumber = (SegmentDetection -> Maybe Natural)
-> (SegmentDetection -> Maybe Natural -> SegmentDetection)
-> Lens
     SegmentDetection SegmentDetection (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SegmentDetection' {Maybe Natural
endFrameNumber :: Maybe Natural
$sel:endFrameNumber:SegmentDetection' :: SegmentDetection -> Maybe Natural
endFrameNumber} -> Maybe Natural
endFrameNumber) (\s :: SegmentDetection
s@SegmentDetection' {} Maybe Natural
a -> SegmentDetection
s {$sel:endFrameNumber:SegmentDetection' :: Maybe Natural
endFrameNumber = Maybe Natural
a} :: SegmentDetection)

-- | The duration of the timecode for the detected segment in SMPTE format.
segmentDetection_durationSMPTE :: Lens.Lens' SegmentDetection (Prelude.Maybe Prelude.Text)
segmentDetection_durationSMPTE :: (Maybe Text -> f (Maybe Text))
-> SegmentDetection -> f SegmentDetection
segmentDetection_durationSMPTE = (SegmentDetection -> Maybe Text)
-> (SegmentDetection -> Maybe Text -> SegmentDetection)
-> Lens SegmentDetection SegmentDetection (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SegmentDetection' {Maybe Text
durationSMPTE :: Maybe Text
$sel:durationSMPTE:SegmentDetection' :: SegmentDetection -> Maybe Text
durationSMPTE} -> Maybe Text
durationSMPTE) (\s :: SegmentDetection
s@SegmentDetection' {} Maybe Text
a -> SegmentDetection
s {$sel:durationSMPTE:SegmentDetection' :: Maybe Text
durationSMPTE = Maybe Text
a} :: SegmentDetection)

-- | The end time of the detected segment, in milliseconds, from the start of
-- the video. This value is rounded down.
segmentDetection_endTimestampMillis :: Lens.Lens' SegmentDetection (Prelude.Maybe Prelude.Integer)
segmentDetection_endTimestampMillis :: (Maybe Integer -> f (Maybe Integer))
-> SegmentDetection -> f SegmentDetection
segmentDetection_endTimestampMillis = (SegmentDetection -> Maybe Integer)
-> (SegmentDetection -> Maybe Integer -> SegmentDetection)
-> Lens
     SegmentDetection SegmentDetection (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SegmentDetection' {Maybe Integer
endTimestampMillis :: Maybe Integer
$sel:endTimestampMillis:SegmentDetection' :: SegmentDetection -> Maybe Integer
endTimestampMillis} -> Maybe Integer
endTimestampMillis) (\s :: SegmentDetection
s@SegmentDetection' {} Maybe Integer
a -> SegmentDetection
s {$sel:endTimestampMillis:SegmentDetection' :: Maybe Integer
endTimestampMillis = Maybe Integer
a} :: SegmentDetection)

-- | The frame-accurate SMPTE timecode, from the start of a video, for the
-- start of a detected segment. @StartTimecode@ is in /HH:MM:SS:fr/ format
-- (and /;fr/ for drop frame-rates).
segmentDetection_startTimecodeSMPTE :: Lens.Lens' SegmentDetection (Prelude.Maybe Prelude.Text)
segmentDetection_startTimecodeSMPTE :: (Maybe Text -> f (Maybe Text))
-> SegmentDetection -> f SegmentDetection
segmentDetection_startTimecodeSMPTE = (SegmentDetection -> Maybe Text)
-> (SegmentDetection -> Maybe Text -> SegmentDetection)
-> Lens SegmentDetection SegmentDetection (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SegmentDetection' {Maybe Text
startTimecodeSMPTE :: Maybe Text
$sel:startTimecodeSMPTE:SegmentDetection' :: SegmentDetection -> Maybe Text
startTimecodeSMPTE} -> Maybe Text
startTimecodeSMPTE) (\s :: SegmentDetection
s@SegmentDetection' {} Maybe Text
a -> SegmentDetection
s {$sel:startTimecodeSMPTE:SegmentDetection' :: Maybe Text
startTimecodeSMPTE = Maybe Text
a} :: SegmentDetection)

-- | The frame-accurate SMPTE timecode, from the start of a video, for the
-- end of a detected segment. @EndTimecode@ is in /HH:MM:SS:fr/ format (and
-- /;fr/ for drop frame-rates).
segmentDetection_endTimecodeSMPTE :: Lens.Lens' SegmentDetection (Prelude.Maybe Prelude.Text)
segmentDetection_endTimecodeSMPTE :: (Maybe Text -> f (Maybe Text))
-> SegmentDetection -> f SegmentDetection
segmentDetection_endTimecodeSMPTE = (SegmentDetection -> Maybe Text)
-> (SegmentDetection -> Maybe Text -> SegmentDetection)
-> Lens SegmentDetection SegmentDetection (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SegmentDetection' {Maybe Text
endTimecodeSMPTE :: Maybe Text
$sel:endTimecodeSMPTE:SegmentDetection' :: SegmentDetection -> Maybe Text
endTimecodeSMPTE} -> Maybe Text
endTimecodeSMPTE) (\s :: SegmentDetection
s@SegmentDetection' {} Maybe Text
a -> SegmentDetection
s {$sel:endTimecodeSMPTE:SegmentDetection' :: Maybe Text
endTimecodeSMPTE = Maybe Text
a} :: SegmentDetection)

-- | The duration of the detected segment in milliseconds.
segmentDetection_durationMillis :: Lens.Lens' SegmentDetection (Prelude.Maybe Prelude.Natural)
segmentDetection_durationMillis :: (Maybe Natural -> f (Maybe Natural))
-> SegmentDetection -> f SegmentDetection
segmentDetection_durationMillis = (SegmentDetection -> Maybe Natural)
-> (SegmentDetection -> Maybe Natural -> SegmentDetection)
-> Lens
     SegmentDetection SegmentDetection (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SegmentDetection' {Maybe Natural
durationMillis :: Maybe Natural
$sel:durationMillis:SegmentDetection' :: SegmentDetection -> Maybe Natural
durationMillis} -> Maybe Natural
durationMillis) (\s :: SegmentDetection
s@SegmentDetection' {} Maybe Natural
a -> SegmentDetection
s {$sel:durationMillis:SegmentDetection' :: Maybe Natural
durationMillis = Maybe Natural
a} :: SegmentDetection)

-- | The duration of a video segment, expressed in frames.
segmentDetection_durationFrames :: Lens.Lens' SegmentDetection (Prelude.Maybe Prelude.Natural)
segmentDetection_durationFrames :: (Maybe Natural -> f (Maybe Natural))
-> SegmentDetection -> f SegmentDetection
segmentDetection_durationFrames = (SegmentDetection -> Maybe Natural)
-> (SegmentDetection -> Maybe Natural -> SegmentDetection)
-> Lens
     SegmentDetection SegmentDetection (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SegmentDetection' {Maybe Natural
durationFrames :: Maybe Natural
$sel:durationFrames:SegmentDetection' :: SegmentDetection -> Maybe Natural
durationFrames} -> Maybe Natural
durationFrames) (\s :: SegmentDetection
s@SegmentDetection' {} Maybe Natural
a -> SegmentDetection
s {$sel:durationFrames:SegmentDetection' :: Maybe Natural
durationFrames = Maybe Natural
a} :: SegmentDetection)

-- | The start time of the detected segment in milliseconds from the start of
-- the video. This value is rounded down. For example, if the actual
-- timestamp is 100.6667 milliseconds, Amazon Rekognition Video returns a
-- value of 100 millis.
segmentDetection_startTimestampMillis :: Lens.Lens' SegmentDetection (Prelude.Maybe Prelude.Integer)
segmentDetection_startTimestampMillis :: (Maybe Integer -> f (Maybe Integer))
-> SegmentDetection -> f SegmentDetection
segmentDetection_startTimestampMillis = (SegmentDetection -> Maybe Integer)
-> (SegmentDetection -> Maybe Integer -> SegmentDetection)
-> Lens
     SegmentDetection SegmentDetection (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SegmentDetection' {Maybe Integer
startTimestampMillis :: Maybe Integer
$sel:startTimestampMillis:SegmentDetection' :: SegmentDetection -> Maybe Integer
startTimestampMillis} -> Maybe Integer
startTimestampMillis) (\s :: SegmentDetection
s@SegmentDetection' {} Maybe Integer
a -> SegmentDetection
s {$sel:startTimestampMillis:SegmentDetection' :: Maybe Integer
startTimestampMillis = Maybe Integer
a} :: SegmentDetection)

-- | The type of the segment. Valid values are @TECHNICAL_CUE@ and @SHOT@.
segmentDetection_type :: Lens.Lens' SegmentDetection (Prelude.Maybe SegmentType)
segmentDetection_type :: (Maybe SegmentType -> f (Maybe SegmentType))
-> SegmentDetection -> f SegmentDetection
segmentDetection_type = (SegmentDetection -> Maybe SegmentType)
-> (SegmentDetection -> Maybe SegmentType -> SegmentDetection)
-> Lens
     SegmentDetection
     SegmentDetection
     (Maybe SegmentType)
     (Maybe SegmentType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SegmentDetection' {Maybe SegmentType
type' :: Maybe SegmentType
$sel:type':SegmentDetection' :: SegmentDetection -> Maybe SegmentType
type'} -> Maybe SegmentType
type') (\s :: SegmentDetection
s@SegmentDetection' {} Maybe SegmentType
a -> SegmentDetection
s {$sel:type':SegmentDetection' :: Maybe SegmentType
type' = Maybe SegmentType
a} :: SegmentDetection)

-- | If the segment is a shot detection, contains information about the shot
-- detection.
segmentDetection_shotSegment :: Lens.Lens' SegmentDetection (Prelude.Maybe ShotSegment)
segmentDetection_shotSegment :: (Maybe ShotSegment -> f (Maybe ShotSegment))
-> SegmentDetection -> f SegmentDetection
segmentDetection_shotSegment = (SegmentDetection -> Maybe ShotSegment)
-> (SegmentDetection -> Maybe ShotSegment -> SegmentDetection)
-> Lens
     SegmentDetection
     SegmentDetection
     (Maybe ShotSegment)
     (Maybe ShotSegment)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SegmentDetection' {Maybe ShotSegment
shotSegment :: Maybe ShotSegment
$sel:shotSegment:SegmentDetection' :: SegmentDetection -> Maybe ShotSegment
shotSegment} -> Maybe ShotSegment
shotSegment) (\s :: SegmentDetection
s@SegmentDetection' {} Maybe ShotSegment
a -> SegmentDetection
s {$sel:shotSegment:SegmentDetection' :: Maybe ShotSegment
shotSegment = Maybe ShotSegment
a} :: SegmentDetection)

-- | The frame number of the start of a video segment, using a frame index
-- that starts with 0.
segmentDetection_startFrameNumber :: Lens.Lens' SegmentDetection (Prelude.Maybe Prelude.Natural)
segmentDetection_startFrameNumber :: (Maybe Natural -> f (Maybe Natural))
-> SegmentDetection -> f SegmentDetection
segmentDetection_startFrameNumber = (SegmentDetection -> Maybe Natural)
-> (SegmentDetection -> Maybe Natural -> SegmentDetection)
-> Lens
     SegmentDetection SegmentDetection (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SegmentDetection' {Maybe Natural
startFrameNumber :: Maybe Natural
$sel:startFrameNumber:SegmentDetection' :: SegmentDetection -> Maybe Natural
startFrameNumber} -> Maybe Natural
startFrameNumber) (\s :: SegmentDetection
s@SegmentDetection' {} Maybe Natural
a -> SegmentDetection
s {$sel:startFrameNumber:SegmentDetection' :: Maybe Natural
startFrameNumber = Maybe Natural
a} :: SegmentDetection)

instance Core.FromJSON SegmentDetection where
  parseJSON :: Value -> Parser SegmentDetection
parseJSON =
    String
-> (Object -> Parser SegmentDetection)
-> Value
-> Parser SegmentDetection
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SegmentDetection"
      ( \Object
x ->
          Maybe TechnicalCueSegment
-> Maybe Natural
-> Maybe Text
-> Maybe Integer
-> Maybe Text
-> Maybe Text
-> Maybe Natural
-> Maybe Natural
-> Maybe Integer
-> Maybe SegmentType
-> Maybe ShotSegment
-> Maybe Natural
-> SegmentDetection
SegmentDetection'
            (Maybe TechnicalCueSegment
 -> Maybe Natural
 -> Maybe Text
 -> Maybe Integer
 -> Maybe Text
 -> Maybe Text
 -> Maybe Natural
 -> Maybe Natural
 -> Maybe Integer
 -> Maybe SegmentType
 -> Maybe ShotSegment
 -> Maybe Natural
 -> SegmentDetection)
-> Parser (Maybe TechnicalCueSegment)
-> Parser
     (Maybe Natural
      -> Maybe Text
      -> Maybe Integer
      -> Maybe Text
      -> Maybe Text
      -> Maybe Natural
      -> Maybe Natural
      -> Maybe Integer
      -> Maybe SegmentType
      -> Maybe ShotSegment
      -> Maybe Natural
      -> SegmentDetection)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe TechnicalCueSegment)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"TechnicalCueSegment")
            Parser
  (Maybe Natural
   -> Maybe Text
   -> Maybe Integer
   -> Maybe Text
   -> Maybe Text
   -> Maybe Natural
   -> Maybe Natural
   -> Maybe Integer
   -> Maybe SegmentType
   -> Maybe ShotSegment
   -> Maybe Natural
   -> SegmentDetection)
-> Parser (Maybe Natural)
-> Parser
     (Maybe Text
      -> Maybe Integer
      -> Maybe Text
      -> Maybe Text
      -> Maybe Natural
      -> Maybe Natural
      -> Maybe Integer
      -> Maybe SegmentType
      -> Maybe ShotSegment
      -> Maybe Natural
      -> SegmentDetection)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"EndFrameNumber")
            Parser
  (Maybe Text
   -> Maybe Integer
   -> Maybe Text
   -> Maybe Text
   -> Maybe Natural
   -> Maybe Natural
   -> Maybe Integer
   -> Maybe SegmentType
   -> Maybe ShotSegment
   -> Maybe Natural
   -> SegmentDetection)
-> Parser (Maybe Text)
-> Parser
     (Maybe Integer
      -> Maybe Text
      -> Maybe Text
      -> Maybe Natural
      -> Maybe Natural
      -> Maybe Integer
      -> Maybe SegmentType
      -> Maybe ShotSegment
      -> Maybe Natural
      -> SegmentDetection)
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
"DurationSMPTE")
            Parser
  (Maybe Integer
   -> Maybe Text
   -> Maybe Text
   -> Maybe Natural
   -> Maybe Natural
   -> Maybe Integer
   -> Maybe SegmentType
   -> Maybe ShotSegment
   -> Maybe Natural
   -> SegmentDetection)
-> Parser (Maybe Integer)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Natural
      -> Maybe Natural
      -> Maybe Integer
      -> Maybe SegmentType
      -> Maybe ShotSegment
      -> Maybe Natural
      -> SegmentDetection)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"EndTimestampMillis")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Natural
   -> Maybe Natural
   -> Maybe Integer
   -> Maybe SegmentType
   -> Maybe ShotSegment
   -> Maybe Natural
   -> SegmentDetection)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Natural
      -> Maybe Natural
      -> Maybe Integer
      -> Maybe SegmentType
      -> Maybe ShotSegment
      -> Maybe Natural
      -> SegmentDetection)
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
"StartTimecodeSMPTE")
            Parser
  (Maybe Text
   -> Maybe Natural
   -> Maybe Natural
   -> Maybe Integer
   -> Maybe SegmentType
   -> Maybe ShotSegment
   -> Maybe Natural
   -> SegmentDetection)
-> Parser (Maybe Text)
-> Parser
     (Maybe Natural
      -> Maybe Natural
      -> Maybe Integer
      -> Maybe SegmentType
      -> Maybe ShotSegment
      -> Maybe Natural
      -> SegmentDetection)
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
"EndTimecodeSMPTE")
            Parser
  (Maybe Natural
   -> Maybe Natural
   -> Maybe Integer
   -> Maybe SegmentType
   -> Maybe ShotSegment
   -> Maybe Natural
   -> SegmentDetection)
-> Parser (Maybe Natural)
-> Parser
     (Maybe Natural
      -> Maybe Integer
      -> Maybe SegmentType
      -> Maybe ShotSegment
      -> Maybe Natural
      -> SegmentDetection)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DurationMillis")
            Parser
  (Maybe Natural
   -> Maybe Integer
   -> Maybe SegmentType
   -> Maybe ShotSegment
   -> Maybe Natural
   -> SegmentDetection)
-> Parser (Maybe Natural)
-> Parser
     (Maybe Integer
      -> Maybe SegmentType
      -> Maybe ShotSegment
      -> Maybe Natural
      -> SegmentDetection)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DurationFrames")
            Parser
  (Maybe Integer
   -> Maybe SegmentType
   -> Maybe ShotSegment
   -> Maybe Natural
   -> SegmentDetection)
-> Parser (Maybe Integer)
-> Parser
     (Maybe SegmentType
      -> Maybe ShotSegment -> Maybe Natural -> SegmentDetection)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"StartTimestampMillis")
            Parser
  (Maybe SegmentType
   -> Maybe ShotSegment -> Maybe Natural -> SegmentDetection)
-> Parser (Maybe SegmentType)
-> Parser (Maybe ShotSegment -> Maybe Natural -> SegmentDetection)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe SegmentType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Type")
            Parser (Maybe ShotSegment -> Maybe Natural -> SegmentDetection)
-> Parser (Maybe ShotSegment)
-> Parser (Maybe Natural -> SegmentDetection)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ShotSegment)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ShotSegment")
            Parser (Maybe Natural -> SegmentDetection)
-> Parser (Maybe Natural) -> Parser SegmentDetection
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"StartFrameNumber")
      )

instance Prelude.Hashable SegmentDetection

instance Prelude.NFData SegmentDetection