{-# 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.ShotSegment
-- 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.ShotSegment 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

-- | Information about a shot detection segment detected in a video. For more
-- information, see SegmentDetection.
--
-- /See:/ 'newShotSegment' smart constructor.
data ShotSegment = ShotSegment'
  { -- | The confidence that Amazon Rekognition Video has in the accuracy of the
    -- detected segment.
    ShotSegment -> Maybe Double
confidence :: Prelude.Maybe Prelude.Double,
    -- | An Identifier for a shot detection segment detected in a video.
    ShotSegment -> Maybe Natural
index :: Prelude.Maybe Prelude.Natural
  }
  deriving (ShotSegment -> ShotSegment -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ShotSegment -> ShotSegment -> Bool
$c/= :: ShotSegment -> ShotSegment -> Bool
== :: ShotSegment -> ShotSegment -> Bool
$c== :: ShotSegment -> ShotSegment -> Bool
Prelude.Eq, ReadPrec [ShotSegment]
ReadPrec ShotSegment
Int -> ReadS ShotSegment
ReadS [ShotSegment]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ShotSegment]
$creadListPrec :: ReadPrec [ShotSegment]
readPrec :: ReadPrec ShotSegment
$creadPrec :: ReadPrec ShotSegment
readList :: ReadS [ShotSegment]
$creadList :: ReadS [ShotSegment]
readsPrec :: Int -> ReadS ShotSegment
$creadsPrec :: Int -> ReadS ShotSegment
Prelude.Read, Int -> ShotSegment -> ShowS
[ShotSegment] -> ShowS
ShotSegment -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ShotSegment] -> ShowS
$cshowList :: [ShotSegment] -> ShowS
show :: ShotSegment -> String
$cshow :: ShotSegment -> String
showsPrec :: Int -> ShotSegment -> ShowS
$cshowsPrec :: Int -> ShotSegment -> ShowS
Prelude.Show, forall x. Rep ShotSegment x -> ShotSegment
forall x. ShotSegment -> Rep ShotSegment x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ShotSegment x -> ShotSegment
$cfrom :: forall x. ShotSegment -> Rep ShotSegment x
Prelude.Generic)

-- |
-- Create a value of 'ShotSegment' 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:
--
-- 'confidence', 'shotSegment_confidence' - The confidence that Amazon Rekognition Video has in the accuracy of the
-- detected segment.
--
-- 'index', 'shotSegment_index' - An Identifier for a shot detection segment detected in a video.
newShotSegment ::
  ShotSegment
newShotSegment :: ShotSegment
newShotSegment =
  ShotSegment'
    { $sel:confidence:ShotSegment' :: Maybe Double
confidence = forall a. Maybe a
Prelude.Nothing,
      $sel:index:ShotSegment' :: Maybe Natural
index = forall a. Maybe a
Prelude.Nothing
    }

-- | The confidence that Amazon Rekognition Video has in the accuracy of the
-- detected segment.
shotSegment_confidence :: Lens.Lens' ShotSegment (Prelude.Maybe Prelude.Double)
shotSegment_confidence :: Lens' ShotSegment (Maybe Double)
shotSegment_confidence = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ShotSegment' {Maybe Double
confidence :: Maybe Double
$sel:confidence:ShotSegment' :: ShotSegment -> Maybe Double
confidence} -> Maybe Double
confidence) (\s :: ShotSegment
s@ShotSegment' {} Maybe Double
a -> ShotSegment
s {$sel:confidence:ShotSegment' :: Maybe Double
confidence = Maybe Double
a} :: ShotSegment)

-- | An Identifier for a shot detection segment detected in a video.
shotSegment_index :: Lens.Lens' ShotSegment (Prelude.Maybe Prelude.Natural)
shotSegment_index :: Lens' ShotSegment (Maybe Natural)
shotSegment_index = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ShotSegment' {Maybe Natural
index :: Maybe Natural
$sel:index:ShotSegment' :: ShotSegment -> Maybe Natural
index} -> Maybe Natural
index) (\s :: ShotSegment
s@ShotSegment' {} Maybe Natural
a -> ShotSegment
s {$sel:index:ShotSegment' :: Maybe Natural
index = Maybe Natural
a} :: ShotSegment)

instance Data.FromJSON ShotSegment where
  parseJSON :: Value -> Parser ShotSegment
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ShotSegment"
      ( \Object
x ->
          Maybe Double -> Maybe Natural -> ShotSegment
ShotSegment'
            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
"Confidence")
            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
"Index")
      )

instance Prelude.Hashable ShotSegment where
  hashWithSalt :: Int -> ShotSegment -> Int
hashWithSalt Int
_salt ShotSegment' {Maybe Double
Maybe Natural
index :: Maybe Natural
confidence :: Maybe Double
$sel:index:ShotSegment' :: ShotSegment -> Maybe Natural
$sel:confidence:ShotSegment' :: ShotSegment -> Maybe Double
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
confidence
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
index

instance Prelude.NFData ShotSegment where
  rnf :: ShotSegment -> ()
rnf ShotSegment' {Maybe Double
Maybe Natural
index :: Maybe Natural
confidence :: Maybe Double
$sel:index:ShotSegment' :: ShotSegment -> Maybe Natural
$sel:confidence:ShotSegment' :: ShotSegment -> Maybe Double
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
confidence
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
index