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

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

-- | Details regarding output
--
-- /See:/ 'newOutputDetail' smart constructor.
data OutputDetail = OutputDetail'
  { -- | Contains details about the output\'s video stream
    OutputDetail -> Maybe VideoDetail
videoDetails :: Prelude.Maybe VideoDetail,
    -- | Duration in milliseconds
    OutputDetail -> Maybe Int
durationInMs :: Prelude.Maybe Prelude.Int
  }
  deriving (OutputDetail -> OutputDetail -> Bool
(OutputDetail -> OutputDetail -> Bool)
-> (OutputDetail -> OutputDetail -> Bool) -> Eq OutputDetail
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]
(Int -> ReadS OutputDetail)
-> ReadS [OutputDetail]
-> ReadPrec OutputDetail
-> ReadPrec [OutputDetail]
-> Read 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
(Int -> OutputDetail -> ShowS)
-> (OutputDetail -> String)
-> ([OutputDetail] -> ShowS)
-> Show OutputDetail
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. OutputDetail -> Rep OutputDetail x)
-> (forall x. Rep OutputDetail x -> OutputDetail)
-> Generic OutputDetail
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:
--
-- 'videoDetails', 'outputDetail_videoDetails' - Contains details about the output\'s video stream
--
-- 'durationInMs', 'outputDetail_durationInMs' - Duration in milliseconds
newOutputDetail ::
  OutputDetail
newOutputDetail :: OutputDetail
newOutputDetail =
  OutputDetail' :: Maybe VideoDetail -> Maybe Int -> OutputDetail
OutputDetail'
    { $sel:videoDetails:OutputDetail' :: Maybe VideoDetail
videoDetails = Maybe VideoDetail
forall a. Maybe a
Prelude.Nothing,
      $sel:durationInMs:OutputDetail' :: Maybe Int
durationInMs = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | Contains details about the output\'s video stream
outputDetail_videoDetails :: Lens.Lens' OutputDetail (Prelude.Maybe VideoDetail)
outputDetail_videoDetails :: (Maybe VideoDetail -> f (Maybe VideoDetail))
-> OutputDetail -> f OutputDetail
outputDetail_videoDetails = (OutputDetail -> Maybe VideoDetail)
-> (OutputDetail -> Maybe VideoDetail -> OutputDetail)
-> Lens
     OutputDetail OutputDetail (Maybe VideoDetail) (Maybe VideoDetail)
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)

-- | Duration in milliseconds
outputDetail_durationInMs :: Lens.Lens' OutputDetail (Prelude.Maybe Prelude.Int)
outputDetail_durationInMs :: (Maybe Int -> f (Maybe Int)) -> OutputDetail -> f OutputDetail
outputDetail_durationInMs = (OutputDetail -> Maybe Int)
-> (OutputDetail -> Maybe Int -> OutputDetail)
-> Lens OutputDetail OutputDetail (Maybe Int) (Maybe Int)
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)

instance Core.FromJSON OutputDetail where
  parseJSON :: Value -> Parser OutputDetail
parseJSON =
    String
-> (Object -> Parser OutputDetail) -> Value -> Parser OutputDetail
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"OutputDetail"
      ( \Object
x ->
          Maybe VideoDetail -> Maybe Int -> OutputDetail
OutputDetail'
            (Maybe VideoDetail -> Maybe Int -> OutputDetail)
-> Parser (Maybe VideoDetail) -> Parser (Maybe Int -> OutputDetail)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe VideoDetail)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"videoDetails")
            Parser (Maybe Int -> OutputDetail)
-> Parser (Maybe Int) -> Parser OutputDetail
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"durationInMs")
      )

instance Prelude.Hashable OutputDetail

instance Prelude.NFData OutputDetail