{-# 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.QueueTransition
-- 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.QueueTransition 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

-- | Description of the source and destination queues between which the job
-- has moved, along with the timestamp of the move
--
-- /See:/ 'newQueueTransition' smart constructor.
data QueueTransition = QueueTransition'
  { -- | The queue that the job was on after the transition.
    QueueTransition -> Maybe Text
destinationQueue :: Prelude.Maybe Prelude.Text,
    -- | The queue that the job was on before the transition.
    QueueTransition -> Maybe Text
sourceQueue :: Prelude.Maybe Prelude.Text,
    -- | The time, in Unix epoch format, that the job moved from the source queue
    -- to the destination queue.
    QueueTransition -> Maybe POSIX
timestamp :: Prelude.Maybe Data.POSIX
  }
  deriving (QueueTransition -> QueueTransition -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: QueueTransition -> QueueTransition -> Bool
$c/= :: QueueTransition -> QueueTransition -> Bool
== :: QueueTransition -> QueueTransition -> Bool
$c== :: QueueTransition -> QueueTransition -> Bool
Prelude.Eq, ReadPrec [QueueTransition]
ReadPrec QueueTransition
Int -> ReadS QueueTransition
ReadS [QueueTransition]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [QueueTransition]
$creadListPrec :: ReadPrec [QueueTransition]
readPrec :: ReadPrec QueueTransition
$creadPrec :: ReadPrec QueueTransition
readList :: ReadS [QueueTransition]
$creadList :: ReadS [QueueTransition]
readsPrec :: Int -> ReadS QueueTransition
$creadsPrec :: Int -> ReadS QueueTransition
Prelude.Read, Int -> QueueTransition -> ShowS
[QueueTransition] -> ShowS
QueueTransition -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [QueueTransition] -> ShowS
$cshowList :: [QueueTransition] -> ShowS
show :: QueueTransition -> String
$cshow :: QueueTransition -> String
showsPrec :: Int -> QueueTransition -> ShowS
$cshowsPrec :: Int -> QueueTransition -> ShowS
Prelude.Show, forall x. Rep QueueTransition x -> QueueTransition
forall x. QueueTransition -> Rep QueueTransition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep QueueTransition x -> QueueTransition
$cfrom :: forall x. QueueTransition -> Rep QueueTransition x
Prelude.Generic)

-- |
-- Create a value of 'QueueTransition' 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:
--
-- 'destinationQueue', 'queueTransition_destinationQueue' - The queue that the job was on after the transition.
--
-- 'sourceQueue', 'queueTransition_sourceQueue' - The queue that the job was on before the transition.
--
-- 'timestamp', 'queueTransition_timestamp' - The time, in Unix epoch format, that the job moved from the source queue
-- to the destination queue.
newQueueTransition ::
  QueueTransition
newQueueTransition :: QueueTransition
newQueueTransition =
  QueueTransition'
    { $sel:destinationQueue:QueueTransition' :: Maybe Text
destinationQueue =
        forall a. Maybe a
Prelude.Nothing,
      $sel:sourceQueue:QueueTransition' :: Maybe Text
sourceQueue = forall a. Maybe a
Prelude.Nothing,
      $sel:timestamp:QueueTransition' :: Maybe POSIX
timestamp = forall a. Maybe a
Prelude.Nothing
    }

-- | The queue that the job was on after the transition.
queueTransition_destinationQueue :: Lens.Lens' QueueTransition (Prelude.Maybe Prelude.Text)
queueTransition_destinationQueue :: Lens' QueueTransition (Maybe Text)
queueTransition_destinationQueue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueueTransition' {Maybe Text
destinationQueue :: Maybe Text
$sel:destinationQueue:QueueTransition' :: QueueTransition -> Maybe Text
destinationQueue} -> Maybe Text
destinationQueue) (\s :: QueueTransition
s@QueueTransition' {} Maybe Text
a -> QueueTransition
s {$sel:destinationQueue:QueueTransition' :: Maybe Text
destinationQueue = Maybe Text
a} :: QueueTransition)

-- | The queue that the job was on before the transition.
queueTransition_sourceQueue :: Lens.Lens' QueueTransition (Prelude.Maybe Prelude.Text)
queueTransition_sourceQueue :: Lens' QueueTransition (Maybe Text)
queueTransition_sourceQueue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueueTransition' {Maybe Text
sourceQueue :: Maybe Text
$sel:sourceQueue:QueueTransition' :: QueueTransition -> Maybe Text
sourceQueue} -> Maybe Text
sourceQueue) (\s :: QueueTransition
s@QueueTransition' {} Maybe Text
a -> QueueTransition
s {$sel:sourceQueue:QueueTransition' :: Maybe Text
sourceQueue = Maybe Text
a} :: QueueTransition)

-- | The time, in Unix epoch format, that the job moved from the source queue
-- to the destination queue.
queueTransition_timestamp :: Lens.Lens' QueueTransition (Prelude.Maybe Prelude.UTCTime)
queueTransition_timestamp :: Lens' QueueTransition (Maybe UTCTime)
queueTransition_timestamp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueueTransition' {Maybe POSIX
timestamp :: Maybe POSIX
$sel:timestamp:QueueTransition' :: QueueTransition -> Maybe POSIX
timestamp} -> Maybe POSIX
timestamp) (\s :: QueueTransition
s@QueueTransition' {} Maybe POSIX
a -> QueueTransition
s {$sel:timestamp:QueueTransition' :: Maybe POSIX
timestamp = Maybe POSIX
a} :: QueueTransition) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

instance Data.FromJSON QueueTransition where
  parseJSON :: Value -> Parser QueueTransition
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"QueueTransition"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Maybe POSIX -> QueueTransition
QueueTransition'
            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
"destinationQueue")
            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
"sourceQueue")
            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
"timestamp")
      )

instance Prelude.Hashable QueueTransition where
  hashWithSalt :: Int -> QueueTransition -> Int
hashWithSalt Int
_salt QueueTransition' {Maybe Text
Maybe POSIX
timestamp :: Maybe POSIX
sourceQueue :: Maybe Text
destinationQueue :: Maybe Text
$sel:timestamp:QueueTransition' :: QueueTransition -> Maybe POSIX
$sel:sourceQueue:QueueTransition' :: QueueTransition -> Maybe Text
$sel:destinationQueue:QueueTransition' :: QueueTransition -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
destinationQueue
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
sourceQueue
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
timestamp

instance Prelude.NFData QueueTransition where
  rnf :: QueueTransition -> ()
rnf QueueTransition' {Maybe Text
Maybe POSIX
timestamp :: Maybe POSIX
sourceQueue :: Maybe Text
destinationQueue :: Maybe Text
$sel:timestamp:QueueTransition' :: QueueTransition -> Maybe POSIX
$sel:sourceQueue:QueueTransition' :: QueueTransition -> Maybe Text
$sel:destinationQueue:QueueTransition' :: QueueTransition -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
destinationQueue
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
sourceQueue
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
timestamp