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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(ShotSegment -> ShotSegment -> Bool)
-> (ShotSegment -> ShotSegment -> Bool) -> Eq ShotSegment
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]
(Int -> ReadS ShotSegment)
-> ReadS [ShotSegment]
-> ReadPrec ShotSegment
-> ReadPrec [ShotSegment]
-> Read 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
(Int -> ShotSegment -> ShowS)
-> (ShotSegment -> String)
-> ([ShotSegment] -> ShowS)
-> Show ShotSegment
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. ShotSegment -> Rep ShotSegment x)
-> (forall x. Rep ShotSegment x -> ShotSegment)
-> Generic ShotSegment
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' :: Maybe Double -> Maybe Natural -> ShotSegment
ShotSegment'
    { $sel:confidence:ShotSegment' :: Maybe Double
confidence = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:index:ShotSegment' :: Maybe Natural
index = Maybe Natural
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 :: (Maybe Double -> f (Maybe Double)) -> ShotSegment -> f ShotSegment
shotSegment_confidence = (ShotSegment -> Maybe Double)
-> (ShotSegment -> Maybe Double -> ShotSegment)
-> Lens ShotSegment ShotSegment (Maybe Double) (Maybe Double)
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 :: (Maybe Natural -> f (Maybe Natural))
-> ShotSegment -> f ShotSegment
shotSegment_index = (ShotSegment -> Maybe Natural)
-> (ShotSegment -> Maybe Natural -> ShotSegment)
-> Lens ShotSegment ShotSegment (Maybe Natural) (Maybe Natural)
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 Core.FromJSON ShotSegment where
  parseJSON :: Value -> Parser ShotSegment
parseJSON =
    String
-> (Object -> Parser ShotSegment) -> Value -> Parser ShotSegment
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ShotSegment"
      ( \Object
x ->
          Maybe Double -> Maybe Natural -> ShotSegment
ShotSegment'
            (Maybe Double -> Maybe Natural -> ShotSegment)
-> Parser (Maybe Double) -> Parser (Maybe Natural -> ShotSegment)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Confidence")
            Parser (Maybe Natural -> ShotSegment)
-> Parser (Maybe Natural) -> Parser ShotSegment
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
"Index")
      )

instance Prelude.Hashable ShotSegment

instance Prelude.NFData ShotSegment