{-# 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.ElasticTranscoder.Types.DetectedProperties
-- 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.ElasticTranscoder.Types.DetectedProperties 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

-- | The detected properties of the input file. Elastic Transcoder identifies
-- these values from the input file.
--
-- /See:/ 'newDetectedProperties' smart constructor.
data DetectedProperties = DetectedProperties'
  { -- | The detected duration of the input file, in milliseconds.
    DetectedProperties -> Maybe Integer
durationMillis :: Prelude.Maybe Prelude.Integer,
    -- | The detected file size of the input file, in bytes.
    DetectedProperties -> Maybe Integer
fileSize :: Prelude.Maybe Prelude.Integer,
    -- | The detected frame rate of the input file, in frames per second.
    DetectedProperties -> Maybe Text
frameRate :: Prelude.Maybe Prelude.Text,
    -- | The detected height of the input file, in pixels.
    DetectedProperties -> Maybe Int
height :: Prelude.Maybe Prelude.Int,
    -- | The detected width of the input file, in pixels.
    DetectedProperties -> Maybe Int
width :: Prelude.Maybe Prelude.Int
  }
  deriving (DetectedProperties -> DetectedProperties -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DetectedProperties -> DetectedProperties -> Bool
$c/= :: DetectedProperties -> DetectedProperties -> Bool
== :: DetectedProperties -> DetectedProperties -> Bool
$c== :: DetectedProperties -> DetectedProperties -> Bool
Prelude.Eq, ReadPrec [DetectedProperties]
ReadPrec DetectedProperties
Int -> ReadS DetectedProperties
ReadS [DetectedProperties]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DetectedProperties]
$creadListPrec :: ReadPrec [DetectedProperties]
readPrec :: ReadPrec DetectedProperties
$creadPrec :: ReadPrec DetectedProperties
readList :: ReadS [DetectedProperties]
$creadList :: ReadS [DetectedProperties]
readsPrec :: Int -> ReadS DetectedProperties
$creadsPrec :: Int -> ReadS DetectedProperties
Prelude.Read, Int -> DetectedProperties -> ShowS
[DetectedProperties] -> ShowS
DetectedProperties -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DetectedProperties] -> ShowS
$cshowList :: [DetectedProperties] -> ShowS
show :: DetectedProperties -> String
$cshow :: DetectedProperties -> String
showsPrec :: Int -> DetectedProperties -> ShowS
$cshowsPrec :: Int -> DetectedProperties -> ShowS
Prelude.Show, forall x. Rep DetectedProperties x -> DetectedProperties
forall x. DetectedProperties -> Rep DetectedProperties x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DetectedProperties x -> DetectedProperties
$cfrom :: forall x. DetectedProperties -> Rep DetectedProperties x
Prelude.Generic)

-- |
-- Create a value of 'DetectedProperties' 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:
--
-- 'durationMillis', 'detectedProperties_durationMillis' - The detected duration of the input file, in milliseconds.
--
-- 'fileSize', 'detectedProperties_fileSize' - The detected file size of the input file, in bytes.
--
-- 'frameRate', 'detectedProperties_frameRate' - The detected frame rate of the input file, in frames per second.
--
-- 'height', 'detectedProperties_height' - The detected height of the input file, in pixels.
--
-- 'width', 'detectedProperties_width' - The detected width of the input file, in pixels.
newDetectedProperties ::
  DetectedProperties
newDetectedProperties :: DetectedProperties
newDetectedProperties =
  DetectedProperties'
    { $sel:durationMillis:DetectedProperties' :: Maybe Integer
durationMillis =
        forall a. Maybe a
Prelude.Nothing,
      $sel:fileSize:DetectedProperties' :: Maybe Integer
fileSize = forall a. Maybe a
Prelude.Nothing,
      $sel:frameRate:DetectedProperties' :: Maybe Text
frameRate = forall a. Maybe a
Prelude.Nothing,
      $sel:height:DetectedProperties' :: Maybe Int
height = forall a. Maybe a
Prelude.Nothing,
      $sel:width:DetectedProperties' :: Maybe Int
width = forall a. Maybe a
Prelude.Nothing
    }

-- | The detected duration of the input file, in milliseconds.
detectedProperties_durationMillis :: Lens.Lens' DetectedProperties (Prelude.Maybe Prelude.Integer)
detectedProperties_durationMillis :: Lens' DetectedProperties (Maybe Integer)
detectedProperties_durationMillis = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectedProperties' {Maybe Integer
durationMillis :: Maybe Integer
$sel:durationMillis:DetectedProperties' :: DetectedProperties -> Maybe Integer
durationMillis} -> Maybe Integer
durationMillis) (\s :: DetectedProperties
s@DetectedProperties' {} Maybe Integer
a -> DetectedProperties
s {$sel:durationMillis:DetectedProperties' :: Maybe Integer
durationMillis = Maybe Integer
a} :: DetectedProperties)

-- | The detected file size of the input file, in bytes.
detectedProperties_fileSize :: Lens.Lens' DetectedProperties (Prelude.Maybe Prelude.Integer)
detectedProperties_fileSize :: Lens' DetectedProperties (Maybe Integer)
detectedProperties_fileSize = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectedProperties' {Maybe Integer
fileSize :: Maybe Integer
$sel:fileSize:DetectedProperties' :: DetectedProperties -> Maybe Integer
fileSize} -> Maybe Integer
fileSize) (\s :: DetectedProperties
s@DetectedProperties' {} Maybe Integer
a -> DetectedProperties
s {$sel:fileSize:DetectedProperties' :: Maybe Integer
fileSize = Maybe Integer
a} :: DetectedProperties)

-- | The detected frame rate of the input file, in frames per second.
detectedProperties_frameRate :: Lens.Lens' DetectedProperties (Prelude.Maybe Prelude.Text)
detectedProperties_frameRate :: Lens' DetectedProperties (Maybe Text)
detectedProperties_frameRate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectedProperties' {Maybe Text
frameRate :: Maybe Text
$sel:frameRate:DetectedProperties' :: DetectedProperties -> Maybe Text
frameRate} -> Maybe Text
frameRate) (\s :: DetectedProperties
s@DetectedProperties' {} Maybe Text
a -> DetectedProperties
s {$sel:frameRate:DetectedProperties' :: Maybe Text
frameRate = Maybe Text
a} :: DetectedProperties)

-- | The detected height of the input file, in pixels.
detectedProperties_height :: Lens.Lens' DetectedProperties (Prelude.Maybe Prelude.Int)
detectedProperties_height :: Lens' DetectedProperties (Maybe Int)
detectedProperties_height = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectedProperties' {Maybe Int
height :: Maybe Int
$sel:height:DetectedProperties' :: DetectedProperties -> Maybe Int
height} -> Maybe Int
height) (\s :: DetectedProperties
s@DetectedProperties' {} Maybe Int
a -> DetectedProperties
s {$sel:height:DetectedProperties' :: Maybe Int
height = Maybe Int
a} :: DetectedProperties)

-- | The detected width of the input file, in pixels.
detectedProperties_width :: Lens.Lens' DetectedProperties (Prelude.Maybe Prelude.Int)
detectedProperties_width :: Lens' DetectedProperties (Maybe Int)
detectedProperties_width = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectedProperties' {Maybe Int
width :: Maybe Int
$sel:width:DetectedProperties' :: DetectedProperties -> Maybe Int
width} -> Maybe Int
width) (\s :: DetectedProperties
s@DetectedProperties' {} Maybe Int
a -> DetectedProperties
s {$sel:width:DetectedProperties' :: Maybe Int
width = Maybe Int
a} :: DetectedProperties)

instance Data.FromJSON DetectedProperties where
  parseJSON :: Value -> Parser DetectedProperties
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"DetectedProperties"
      ( \Object
x ->
          Maybe Integer
-> Maybe Integer
-> Maybe Text
-> Maybe Int
-> Maybe Int
-> DetectedProperties
DetectedProperties'
            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
"DurationMillis")
            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
"FileSize")
            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
"FrameRate")
            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
"Height")
            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
"Width")
      )

instance Prelude.Hashable DetectedProperties where
  hashWithSalt :: Int -> DetectedProperties -> Int
hashWithSalt Int
_salt DetectedProperties' {Maybe Int
Maybe Integer
Maybe Text
width :: Maybe Int
height :: Maybe Int
frameRate :: Maybe Text
fileSize :: Maybe Integer
durationMillis :: Maybe Integer
$sel:width:DetectedProperties' :: DetectedProperties -> Maybe Int
$sel:height:DetectedProperties' :: DetectedProperties -> Maybe Int
$sel:frameRate:DetectedProperties' :: DetectedProperties -> Maybe Text
$sel:fileSize:DetectedProperties' :: DetectedProperties -> Maybe Integer
$sel:durationMillis:DetectedProperties' :: DetectedProperties -> Maybe Integer
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
durationMillis
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
fileSize
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
frameRate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
height
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
width

instance Prelude.NFData DetectedProperties where
  rnf :: DetectedProperties -> ()
rnf DetectedProperties' {Maybe Int
Maybe Integer
Maybe Text
width :: Maybe Int
height :: Maybe Int
frameRate :: Maybe Text
fileSize :: Maybe Integer
durationMillis :: Maybe Integer
$sel:width:DetectedProperties' :: DetectedProperties -> Maybe Int
$sel:height:DetectedProperties' :: DetectedProperties -> Maybe Int
$sel:frameRate:DetectedProperties' :: DetectedProperties -> Maybe Text
$sel:fileSize:DetectedProperties' :: DetectedProperties -> Maybe Integer
$sel:durationMillis:DetectedProperties' :: DetectedProperties -> Maybe Integer
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
durationMillis
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
fileSize
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
frameRate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
height
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
width

instance Data.ToJSON DetectedProperties where
  toJSON :: DetectedProperties -> Value
toJSON DetectedProperties' {Maybe Int
Maybe Integer
Maybe Text
width :: Maybe Int
height :: Maybe Int
frameRate :: Maybe Text
fileSize :: Maybe Integer
durationMillis :: Maybe Integer
$sel:width:DetectedProperties' :: DetectedProperties -> Maybe Int
$sel:height:DetectedProperties' :: DetectedProperties -> Maybe Int
$sel:frameRate:DetectedProperties' :: DetectedProperties -> Maybe Text
$sel:fileSize:DetectedProperties' :: DetectedProperties -> Maybe Integer
$sel:durationMillis:DetectedProperties' :: DetectedProperties -> Maybe Integer
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"DurationMillis" 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 Integer
durationMillis,
            (Key
"FileSize" 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 Integer
fileSize,
            (Key
"FrameRate" 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
frameRate,
            (Key
"Height" 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 Int
height,
            (Key
"Width" 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 Int
width
          ]
      )