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

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

-- | Information about when jobs are submitted, started, and finished is
-- specified in Unix epoch format in seconds.
--
-- /See:/ 'newTiming' smart constructor.
data Timing = Timing'
  { -- | The time, in Unix epoch format, that transcoding for the job began.
    Timing -> Maybe POSIX
startTime :: Prelude.Maybe Core.POSIX,
    -- | The time, in Unix epoch format, that the transcoding job finished
    Timing -> Maybe POSIX
finishTime :: Prelude.Maybe Core.POSIX,
    -- | The time, in Unix epoch format, that you submitted the job.
    Timing -> Maybe POSIX
submitTime :: Prelude.Maybe Core.POSIX
  }
  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:
--
-- 'startTime', 'timing_startTime' - The time, in Unix epoch format, that transcoding for the job began.
--
-- 'finishTime', 'timing_finishTime' - The time, in Unix epoch format, that the transcoding job finished
--
-- 'submitTime', 'timing_submitTime' - The time, in Unix epoch format, that you submitted the job.
newTiming ::
  Timing
newTiming :: Timing
newTiming =
  Timing' :: Maybe POSIX -> Maybe POSIX -> Maybe POSIX -> Timing
Timing'
    { $sel:startTime:Timing' :: Maybe POSIX
startTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:finishTime:Timing' :: Maybe POSIX
finishTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:submitTime:Timing' :: Maybe POSIX
submitTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
    }

-- | The time, in Unix epoch format, that transcoding for the job began.
timing_startTime :: Lens.Lens' Timing (Prelude.Maybe Prelude.UTCTime)
timing_startTime :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Timing -> f Timing
timing_startTime = (Timing -> Maybe POSIX)
-> (Timing -> Maybe POSIX -> Timing)
-> Lens Timing Timing (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Timing' {Maybe POSIX
startTime :: Maybe POSIX
$sel:startTime:Timing' :: Timing -> Maybe POSIX
startTime} -> Maybe POSIX
startTime) (\s :: Timing
s@Timing' {} Maybe POSIX
a -> Timing
s {$sel:startTime:Timing' :: Maybe POSIX
startTime = Maybe POSIX
a} :: Timing) ((Maybe POSIX -> f (Maybe POSIX)) -> Timing -> f Timing)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Timing
-> f Timing
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The time, in Unix epoch format, that the transcoding job finished
timing_finishTime :: Lens.Lens' Timing (Prelude.Maybe Prelude.UTCTime)
timing_finishTime :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Timing -> f Timing
timing_finishTime = (Timing -> Maybe POSIX)
-> (Timing -> Maybe POSIX -> Timing)
-> Lens Timing Timing (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Timing' {Maybe POSIX
finishTime :: Maybe POSIX
$sel:finishTime:Timing' :: Timing -> Maybe POSIX
finishTime} -> Maybe POSIX
finishTime) (\s :: Timing
s@Timing' {} Maybe POSIX
a -> Timing
s {$sel:finishTime:Timing' :: Maybe POSIX
finishTime = Maybe POSIX
a} :: Timing) ((Maybe POSIX -> f (Maybe POSIX)) -> Timing -> f Timing)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Timing
-> f Timing
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The time, in Unix epoch format, that you submitted the job.
timing_submitTime :: Lens.Lens' Timing (Prelude.Maybe Prelude.UTCTime)
timing_submitTime :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Timing -> f Timing
timing_submitTime = (Timing -> Maybe POSIX)
-> (Timing -> Maybe POSIX -> Timing)
-> Lens Timing Timing (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Timing' {Maybe POSIX
submitTime :: Maybe POSIX
$sel:submitTime:Timing' :: Timing -> Maybe POSIX
submitTime} -> Maybe POSIX
submitTime) (\s :: Timing
s@Timing' {} Maybe POSIX
a -> Timing
s {$sel:submitTime:Timing' :: Maybe POSIX
submitTime = Maybe POSIX
a} :: Timing) ((Maybe POSIX -> f (Maybe POSIX)) -> Timing -> f Timing)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Timing
-> f Timing
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

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 POSIX -> Maybe POSIX -> Maybe POSIX -> Timing
Timing'
            (Maybe POSIX -> Maybe POSIX -> Maybe POSIX -> Timing)
-> Parser (Maybe POSIX)
-> Parser (Maybe POSIX -> Maybe POSIX -> Timing)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"startTime")
            Parser (Maybe POSIX -> Maybe POSIX -> Timing)
-> Parser (Maybe POSIX) -> Parser (Maybe POSIX -> Timing)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"finishTime")
            Parser (Maybe POSIX -> Timing)
-> Parser (Maybe POSIX) -> Parser Timing
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"submitTime")
      )

instance Prelude.Hashable Timing

instance Prelude.NFData Timing