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

-- | Optional. Configuration for a destination queue to which the job can hop
-- once a customer-defined minimum wait time has passed.
--
-- /See:/ 'newHopDestination' smart constructor.
data HopDestination = HopDestination'
  { -- | Optional. When you set up a job to use queue hopping, you can specify a
    -- different relative priority for the job in the destination queue. If you
    -- don\'t specify, the relative priority will remain the same as in the
    -- previous queue.
    HopDestination -> Maybe Int
priority :: Prelude.Maybe Prelude.Int,
    -- | Optional unless the job is submitted on the default queue. When you set
    -- up a job to use queue hopping, you can specify a destination queue. This
    -- queue cannot be the original queue to which the job is submitted. If the
    -- original queue isn\'t the default queue and you don\'t specify the
    -- destination queue, the job will move to the default queue.
    HopDestination -> Maybe Text
queue :: Prelude.Maybe Prelude.Text,
    -- | Required for setting up a job to use queue hopping. Minimum wait time in
    -- minutes until the job can hop to the destination queue. Valid range is 1
    -- to 1440 minutes, inclusive.
    HopDestination -> Maybe Int
waitMinutes :: Prelude.Maybe Prelude.Int
  }
  deriving (HopDestination -> HopDestination -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HopDestination -> HopDestination -> Bool
$c/= :: HopDestination -> HopDestination -> Bool
== :: HopDestination -> HopDestination -> Bool
$c== :: HopDestination -> HopDestination -> Bool
Prelude.Eq, ReadPrec [HopDestination]
ReadPrec HopDestination
Int -> ReadS HopDestination
ReadS [HopDestination]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [HopDestination]
$creadListPrec :: ReadPrec [HopDestination]
readPrec :: ReadPrec HopDestination
$creadPrec :: ReadPrec HopDestination
readList :: ReadS [HopDestination]
$creadList :: ReadS [HopDestination]
readsPrec :: Int -> ReadS HopDestination
$creadsPrec :: Int -> ReadS HopDestination
Prelude.Read, Int -> HopDestination -> ShowS
[HopDestination] -> ShowS
HopDestination -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HopDestination] -> ShowS
$cshowList :: [HopDestination] -> ShowS
show :: HopDestination -> String
$cshow :: HopDestination -> String
showsPrec :: Int -> HopDestination -> ShowS
$cshowsPrec :: Int -> HopDestination -> ShowS
Prelude.Show, forall x. Rep HopDestination x -> HopDestination
forall x. HopDestination -> Rep HopDestination x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep HopDestination x -> HopDestination
$cfrom :: forall x. HopDestination -> Rep HopDestination x
Prelude.Generic)

-- |
-- Create a value of 'HopDestination' 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:
--
-- 'priority', 'hopDestination_priority' - Optional. When you set up a job to use queue hopping, you can specify a
-- different relative priority for the job in the destination queue. If you
-- don\'t specify, the relative priority will remain the same as in the
-- previous queue.
--
-- 'queue', 'hopDestination_queue' - Optional unless the job is submitted on the default queue. When you set
-- up a job to use queue hopping, you can specify a destination queue. This
-- queue cannot be the original queue to which the job is submitted. If the
-- original queue isn\'t the default queue and you don\'t specify the
-- destination queue, the job will move to the default queue.
--
-- 'waitMinutes', 'hopDestination_waitMinutes' - Required for setting up a job to use queue hopping. Minimum wait time in
-- minutes until the job can hop to the destination queue. Valid range is 1
-- to 1440 minutes, inclusive.
newHopDestination ::
  HopDestination
newHopDestination :: HopDestination
newHopDestination =
  HopDestination'
    { $sel:priority:HopDestination' :: Maybe Int
priority = forall a. Maybe a
Prelude.Nothing,
      $sel:queue:HopDestination' :: Maybe Text
queue = forall a. Maybe a
Prelude.Nothing,
      $sel:waitMinutes:HopDestination' :: Maybe Int
waitMinutes = forall a. Maybe a
Prelude.Nothing
    }

-- | Optional. When you set up a job to use queue hopping, you can specify a
-- different relative priority for the job in the destination queue. If you
-- don\'t specify, the relative priority will remain the same as in the
-- previous queue.
hopDestination_priority :: Lens.Lens' HopDestination (Prelude.Maybe Prelude.Int)
hopDestination_priority :: Lens' HopDestination (Maybe Int)
hopDestination_priority = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HopDestination' {Maybe Int
priority :: Maybe Int
$sel:priority:HopDestination' :: HopDestination -> Maybe Int
priority} -> Maybe Int
priority) (\s :: HopDestination
s@HopDestination' {} Maybe Int
a -> HopDestination
s {$sel:priority:HopDestination' :: Maybe Int
priority = Maybe Int
a} :: HopDestination)

-- | Optional unless the job is submitted on the default queue. When you set
-- up a job to use queue hopping, you can specify a destination queue. This
-- queue cannot be the original queue to which the job is submitted. If the
-- original queue isn\'t the default queue and you don\'t specify the
-- destination queue, the job will move to the default queue.
hopDestination_queue :: Lens.Lens' HopDestination (Prelude.Maybe Prelude.Text)
hopDestination_queue :: Lens' HopDestination (Maybe Text)
hopDestination_queue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HopDestination' {Maybe Text
queue :: Maybe Text
$sel:queue:HopDestination' :: HopDestination -> Maybe Text
queue} -> Maybe Text
queue) (\s :: HopDestination
s@HopDestination' {} Maybe Text
a -> HopDestination
s {$sel:queue:HopDestination' :: Maybe Text
queue = Maybe Text
a} :: HopDestination)

-- | Required for setting up a job to use queue hopping. Minimum wait time in
-- minutes until the job can hop to the destination queue. Valid range is 1
-- to 1440 minutes, inclusive.
hopDestination_waitMinutes :: Lens.Lens' HopDestination (Prelude.Maybe Prelude.Int)
hopDestination_waitMinutes :: Lens' HopDestination (Maybe Int)
hopDestination_waitMinutes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HopDestination' {Maybe Int
waitMinutes :: Maybe Int
$sel:waitMinutes:HopDestination' :: HopDestination -> Maybe Int
waitMinutes} -> Maybe Int
waitMinutes) (\s :: HopDestination
s@HopDestination' {} Maybe Int
a -> HopDestination
s {$sel:waitMinutes:HopDestination' :: Maybe Int
waitMinutes = Maybe Int
a} :: HopDestination)

instance Data.FromJSON HopDestination where
  parseJSON :: Value -> Parser HopDestination
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"HopDestination"
      ( \Object
x ->
          Maybe Int -> Maybe Text -> Maybe Int -> HopDestination
HopDestination'
            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
"priority")
            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
"queue")
            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
"waitMinutes")
      )

instance Prelude.Hashable HopDestination where
  hashWithSalt :: Int -> HopDestination -> Int
hashWithSalt Int
_salt HopDestination' {Maybe Int
Maybe Text
waitMinutes :: Maybe Int
queue :: Maybe Text
priority :: Maybe Int
$sel:waitMinutes:HopDestination' :: HopDestination -> Maybe Int
$sel:queue:HopDestination' :: HopDestination -> Maybe Text
$sel:priority:HopDestination' :: HopDestination -> Maybe Int
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
priority
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
queue
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
waitMinutes

instance Prelude.NFData HopDestination where
  rnf :: HopDestination -> ()
rnf HopDestination' {Maybe Int
Maybe Text
waitMinutes :: Maybe Int
queue :: Maybe Text
priority :: Maybe Int
$sel:waitMinutes:HopDestination' :: HopDestination -> Maybe Int
$sel:queue:HopDestination' :: HopDestination -> Maybe Text
$sel:priority:HopDestination' :: HopDestination -> Maybe Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
priority
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
queue
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
waitMinutes

instance Data.ToJSON HopDestination where
  toJSON :: HopDestination -> Value
toJSON HopDestination' {Maybe Int
Maybe Text
waitMinutes :: Maybe Int
queue :: Maybe Text
priority :: Maybe Int
$sel:waitMinutes:HopDestination' :: HopDestination -> Maybe Int
$sel:queue:HopDestination' :: HopDestination -> Maybe Text
$sel:priority:HopDestination' :: HopDestination -> Maybe Int
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"priority" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
priority,
            (Key
"queue" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
queue,
            (Key
"waitMinutes" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
waitMinutes
          ]
      )