{-# 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.MediaConvert.Types.OutputDetail
-- 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.MediaConvert.Types.OutputDetail where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MediaConvert.Types.VideoDetail
import qualified Amazonka.Prelude as Prelude

-- | Details regarding output
--
-- /See:/ 'newOutputDetail' smart constructor.
data OutputDetail = OutputDetail'
  { -- | Duration in milliseconds
    OutputDetail -> Maybe Int
durationInMs :: Prelude.Maybe Prelude.Int,
    -- | Contains details about the output\'s video stream
    OutputDetail -> Maybe VideoDetail
videoDetails :: Prelude.Maybe VideoDetail
  }
  deriving (OutputDetail -> OutputDetail -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OutputDetail -> OutputDetail -> Bool
$c/= :: OutputDetail -> OutputDetail -> Bool
== :: OutputDetail -> OutputDetail -> Bool
$c== :: OutputDetail -> OutputDetail -> Bool
Prelude.Eq, ReadPrec [OutputDetail]
ReadPrec OutputDetail
Int -> ReadS OutputDetail
ReadS [OutputDetail]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OutputDetail]
$creadListPrec :: ReadPrec [OutputDetail]
readPrec :: ReadPrec OutputDetail
$creadPrec :: ReadPrec OutputDetail
readList :: ReadS [OutputDetail]
$creadList :: ReadS [OutputDetail]
readsPrec :: Int -> ReadS OutputDetail
$creadsPrec :: Int -> ReadS OutputDetail
Prelude.Read, Int -> OutputDetail -> ShowS
[OutputDetail] -> ShowS
OutputDetail -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OutputDetail] -> ShowS
$cshowList :: [OutputDetail] -> ShowS
show :: OutputDetail -> String
$cshow :: OutputDetail -> String
showsPrec :: Int -> OutputDetail -> ShowS
$cshowsPrec :: Int -> OutputDetail -> ShowS
Prelude.Show, forall x. Rep OutputDetail x -> OutputDetail
forall x. OutputDetail -> Rep OutputDetail x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OutputDetail x -> OutputDetail
$cfrom :: forall x. OutputDetail -> Rep OutputDetail x
Prelude.Generic)

-- |
-- Create a value of 'OutputDetail' 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:
--
-- 'durationInMs', 'outputDetail_durationInMs' - Duration in milliseconds
--
-- 'videoDetails', 'outputDetail_videoDetails' - Contains details about the output\'s video stream
newOutputDetail ::
  OutputDetail
newOutputDetail :: OutputDetail
newOutputDetail =
  OutputDetail'
    { $sel:durationInMs:OutputDetail' :: Maybe Int
durationInMs = forall a. Maybe a
Prelude.Nothing,
      $sel:videoDetails:OutputDetail' :: Maybe VideoDetail
videoDetails = forall a. Maybe a
Prelude.Nothing
    }

-- | Duration in milliseconds
outputDetail_durationInMs :: Lens.Lens' OutputDetail (Prelude.Maybe Prelude.Int)
outputDetail_durationInMs :: Lens' OutputDetail (Maybe Int)
outputDetail_durationInMs = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutputDetail' {Maybe Int
durationInMs :: Maybe Int
$sel:durationInMs:OutputDetail' :: OutputDetail -> Maybe Int
durationInMs} -> Maybe Int
durationInMs) (\s :: OutputDetail
s@OutputDetail' {} Maybe Int
a -> OutputDetail
s {$sel:durationInMs:OutputDetail' :: Maybe Int
durationInMs = Maybe Int
a} :: OutputDetail)

-- | Contains details about the output\'s video stream
outputDetail_videoDetails :: Lens.Lens' OutputDetail (Prelude.Maybe VideoDetail)
outputDetail_videoDetails :: Lens' OutputDetail (Maybe VideoDetail)
outputDetail_videoDetails = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutputDetail' {Maybe VideoDetail
videoDetails :: Maybe VideoDetail
$sel:videoDetails:OutputDetail' :: OutputDetail -> Maybe VideoDetail
videoDetails} -> Maybe VideoDetail
videoDetails) (\s :: OutputDetail
s@OutputDetail' {} Maybe VideoDetail
a -> OutputDetail
s {$sel:videoDetails:OutputDetail' :: Maybe VideoDetail
videoDetails = Maybe VideoDetail
a} :: OutputDetail)

instance Data.FromJSON OutputDetail where
  parseJSON :: Value -> Parser OutputDetail
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"OutputDetail"
      ( \Object
x ->
          Maybe Int -> Maybe VideoDetail -> OutputDetail
OutputDetail'
            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
"durationInMs")
            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
"videoDetails")
      )

instance Prelude.Hashable OutputDetail where
  hashWithSalt :: Int -> OutputDetail -> Int
hashWithSalt Int
_salt OutputDetail' {Maybe Int
Maybe VideoDetail
videoDetails :: Maybe VideoDetail
durationInMs :: Maybe Int
$sel:videoDetails:OutputDetail' :: OutputDetail -> Maybe VideoDetail
$sel:durationInMs:OutputDetail' :: OutputDetail -> Maybe Int
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
durationInMs
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe VideoDetail
videoDetails

instance Prelude.NFData OutputDetail where
  rnf :: OutputDetail -> ()
rnf OutputDetail' {Maybe Int
Maybe VideoDetail
videoDetails :: Maybe VideoDetail
durationInMs :: Maybe Int
$sel:videoDetails:OutputDetail' :: OutputDetail -> Maybe VideoDetail
$sel:durationInMs:OutputDetail' :: OutputDetail -> Maybe Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
durationInMs
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe VideoDetail
videoDetails