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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Details about the timing of a job.
--
-- /See:/ 'newTiming' smart constructor.
data Timing = Timing'
  { -- | The time the job was submitted to Elastic Transcoder, in epoch
    -- milliseconds.
    Timing -> Maybe Integer
submitTimeMillis :: Prelude.Maybe Prelude.Integer,
    -- | The time the job finished transcoding, in epoch milliseconds.
    Timing -> Maybe Integer
finishTimeMillis :: Prelude.Maybe Prelude.Integer,
    -- | The time the job began transcoding, in epoch milliseconds.
    Timing -> Maybe Integer
startTimeMillis :: Prelude.Maybe Prelude.Integer
  }
  deriving (Timing -> Timing -> Bool
(Timing -> Timing -> Bool)
-> (Timing -> Timing -> Bool) -> Eq Timing
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Timing -> Timing -> Bool
$c/= :: Timing -> Timing -> Bool
== :: Timing -> Timing -> Bool
$c== :: Timing -> Timing -> Bool
Prelude.Eq, ReadPrec [Timing]
ReadPrec Timing
Int -> ReadS Timing
ReadS [Timing]
(Int -> ReadS Timing)
-> ReadS [Timing]
-> ReadPrec Timing
-> ReadPrec [Timing]
-> Read Timing
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Timing]
$creadListPrec :: ReadPrec [Timing]
readPrec :: ReadPrec Timing
$creadPrec :: ReadPrec Timing
readList :: ReadS [Timing]
$creadList :: ReadS [Timing]
readsPrec :: Int -> ReadS Timing
$creadsPrec :: Int -> ReadS Timing
Prelude.Read, Int -> Timing -> ShowS
[Timing] -> ShowS
Timing -> String
(Int -> Timing -> ShowS)
-> (Timing -> String) -> ([Timing] -> ShowS) -> Show Timing
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Timing] -> ShowS
$cshowList :: [Timing] -> ShowS
show :: Timing -> String
$cshow :: Timing -> String
showsPrec :: Int -> Timing -> ShowS
$cshowsPrec :: Int -> Timing -> ShowS
Prelude.Show, (forall x. Timing -> Rep Timing x)
-> (forall x. Rep Timing x -> Timing) -> Generic Timing
forall x. Rep Timing x -> Timing
forall x. Timing -> Rep Timing x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Timing x -> Timing
$cfrom :: forall x. Timing -> Rep Timing x
Prelude.Generic)

-- |
-- Create a value of 'Timing' 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:
--
-- 'submitTimeMillis', 'timing_submitTimeMillis' - The time the job was submitted to Elastic Transcoder, in epoch
-- milliseconds.
--
-- 'finishTimeMillis', 'timing_finishTimeMillis' - The time the job finished transcoding, in epoch milliseconds.
--
-- 'startTimeMillis', 'timing_startTimeMillis' - The time the job began transcoding, in epoch milliseconds.
newTiming ::
  Timing
newTiming :: Timing
newTiming =
  Timing' :: Maybe Integer -> Maybe Integer -> Maybe Integer -> Timing
Timing'
    { $sel:submitTimeMillis:Timing' :: Maybe Integer
submitTimeMillis = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:finishTimeMillis:Timing' :: Maybe Integer
finishTimeMillis = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:startTimeMillis:Timing' :: Maybe Integer
startTimeMillis = Maybe Integer
forall a. Maybe a
Prelude.Nothing
    }

-- | The time the job was submitted to Elastic Transcoder, in epoch
-- milliseconds.
timing_submitTimeMillis :: Lens.Lens' Timing (Prelude.Maybe Prelude.Integer)
timing_submitTimeMillis :: (Maybe Integer -> f (Maybe Integer)) -> Timing -> f Timing
timing_submitTimeMillis = (Timing -> Maybe Integer)
-> (Timing -> Maybe Integer -> Timing)
-> Lens Timing Timing (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Timing' {Maybe Integer
submitTimeMillis :: Maybe Integer
$sel:submitTimeMillis:Timing' :: Timing -> Maybe Integer
submitTimeMillis} -> Maybe Integer
submitTimeMillis) (\s :: Timing
s@Timing' {} Maybe Integer
a -> Timing
s {$sel:submitTimeMillis:Timing' :: Maybe Integer
submitTimeMillis = Maybe Integer
a} :: Timing)

-- | The time the job finished transcoding, in epoch milliseconds.
timing_finishTimeMillis :: Lens.Lens' Timing (Prelude.Maybe Prelude.Integer)
timing_finishTimeMillis :: (Maybe Integer -> f (Maybe Integer)) -> Timing -> f Timing
timing_finishTimeMillis = (Timing -> Maybe Integer)
-> (Timing -> Maybe Integer -> Timing)
-> Lens Timing Timing (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Timing' {Maybe Integer
finishTimeMillis :: Maybe Integer
$sel:finishTimeMillis:Timing' :: Timing -> Maybe Integer
finishTimeMillis} -> Maybe Integer
finishTimeMillis) (\s :: Timing
s@Timing' {} Maybe Integer
a -> Timing
s {$sel:finishTimeMillis:Timing' :: Maybe Integer
finishTimeMillis = Maybe Integer
a} :: Timing)

-- | The time the job began transcoding, in epoch milliseconds.
timing_startTimeMillis :: Lens.Lens' Timing (Prelude.Maybe Prelude.Integer)
timing_startTimeMillis :: (Maybe Integer -> f (Maybe Integer)) -> Timing -> f Timing
timing_startTimeMillis = (Timing -> Maybe Integer)
-> (Timing -> Maybe Integer -> Timing)
-> Lens Timing Timing (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Timing' {Maybe Integer
startTimeMillis :: Maybe Integer
$sel:startTimeMillis:Timing' :: Timing -> Maybe Integer
startTimeMillis} -> Maybe Integer
startTimeMillis) (\s :: Timing
s@Timing' {} Maybe Integer
a -> Timing
s {$sel:startTimeMillis:Timing' :: Maybe Integer
startTimeMillis = Maybe Integer
a} :: Timing)

instance Core.FromJSON Timing where
  parseJSON :: Value -> Parser Timing
parseJSON =
    String -> (Object -> Parser Timing) -> Value -> Parser Timing
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Timing"
      ( \Object
x ->
          Maybe Integer -> Maybe Integer -> Maybe Integer -> Timing
Timing'
            (Maybe Integer -> Maybe Integer -> Maybe Integer -> Timing)
-> Parser (Maybe Integer)
-> Parser (Maybe Integer -> Maybe Integer -> Timing)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SubmitTimeMillis")
            Parser (Maybe Integer -> Maybe Integer -> Timing)
-> Parser (Maybe Integer) -> Parser (Maybe Integer -> Timing)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"FinishTimeMillis")
            Parser (Maybe Integer -> Timing)
-> Parser (Maybe Integer) -> Parser Timing
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"StartTimeMillis")
      )

instance Prelude.Hashable Timing

instance Prelude.NFData Timing