{-# 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.ReservationPlanSettings
-- 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.ReservationPlanSettings where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaConvert.Types.Commitment
import Amazonka.MediaConvert.Types.RenewalType
import qualified Amazonka.Prelude as Prelude

-- | Details about the pricing plan for your reserved queue. Required for
-- reserved queues and not applicable to on-demand queues.
--
-- /See:/ 'newReservationPlanSettings' smart constructor.
data ReservationPlanSettings = ReservationPlanSettings'
  { -- | The length of the term of your reserved queue pricing plan commitment.
    ReservationPlanSettings -> Commitment
commitment :: Commitment,
    -- | Specifies the number of reserved transcode slots (RTS) for this queue.
    -- The number of RTS determines how many jobs the queue can process in
    -- parallel; each RTS can process one job at a time. You can\'t decrease
    -- the number of RTS in your reserved queue. You can increase the number of
    -- RTS by extending your existing commitment with a new 12-month commitment
    -- for the larger number. The new commitment begins when you purchase the
    -- additional capacity. You can\'t cancel your commitment or revert to your
    -- original commitment after you increase the capacity.
    ReservationPlanSettings -> Int
reservedSlots :: Prelude.Int,
    -- | Specifies whether the term of your reserved queue pricing plan is
    -- automatically extended (AUTO_RENEW) or expires (EXPIRE) at the end of
    -- the term. When your term is auto renewed, you extend your commitment by
    -- 12 months from the auto renew date. You can cancel this commitment.
    ReservationPlanSettings -> RenewalType
renewalType :: RenewalType
  }
  deriving (ReservationPlanSettings -> ReservationPlanSettings -> Bool
(ReservationPlanSettings -> ReservationPlanSettings -> Bool)
-> (ReservationPlanSettings -> ReservationPlanSettings -> Bool)
-> Eq ReservationPlanSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ReservationPlanSettings -> ReservationPlanSettings -> Bool
$c/= :: ReservationPlanSettings -> ReservationPlanSettings -> Bool
== :: ReservationPlanSettings -> ReservationPlanSettings -> Bool
$c== :: ReservationPlanSettings -> ReservationPlanSettings -> Bool
Prelude.Eq, ReadPrec [ReservationPlanSettings]
ReadPrec ReservationPlanSettings
Int -> ReadS ReservationPlanSettings
ReadS [ReservationPlanSettings]
(Int -> ReadS ReservationPlanSettings)
-> ReadS [ReservationPlanSettings]
-> ReadPrec ReservationPlanSettings
-> ReadPrec [ReservationPlanSettings]
-> Read ReservationPlanSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ReservationPlanSettings]
$creadListPrec :: ReadPrec [ReservationPlanSettings]
readPrec :: ReadPrec ReservationPlanSettings
$creadPrec :: ReadPrec ReservationPlanSettings
readList :: ReadS [ReservationPlanSettings]
$creadList :: ReadS [ReservationPlanSettings]
readsPrec :: Int -> ReadS ReservationPlanSettings
$creadsPrec :: Int -> ReadS ReservationPlanSettings
Prelude.Read, Int -> ReservationPlanSettings -> ShowS
[ReservationPlanSettings] -> ShowS
ReservationPlanSettings -> String
(Int -> ReservationPlanSettings -> ShowS)
-> (ReservationPlanSettings -> String)
-> ([ReservationPlanSettings] -> ShowS)
-> Show ReservationPlanSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ReservationPlanSettings] -> ShowS
$cshowList :: [ReservationPlanSettings] -> ShowS
show :: ReservationPlanSettings -> String
$cshow :: ReservationPlanSettings -> String
showsPrec :: Int -> ReservationPlanSettings -> ShowS
$cshowsPrec :: Int -> ReservationPlanSettings -> ShowS
Prelude.Show, (forall x.
 ReservationPlanSettings -> Rep ReservationPlanSettings x)
-> (forall x.
    Rep ReservationPlanSettings x -> ReservationPlanSettings)
-> Generic ReservationPlanSettings
forall x. Rep ReservationPlanSettings x -> ReservationPlanSettings
forall x. ReservationPlanSettings -> Rep ReservationPlanSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ReservationPlanSettings x -> ReservationPlanSettings
$cfrom :: forall x. ReservationPlanSettings -> Rep ReservationPlanSettings x
Prelude.Generic)

-- |
-- Create a value of 'ReservationPlanSettings' 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:
--
-- 'commitment', 'reservationPlanSettings_commitment' - The length of the term of your reserved queue pricing plan commitment.
--
-- 'reservedSlots', 'reservationPlanSettings_reservedSlots' - Specifies the number of reserved transcode slots (RTS) for this queue.
-- The number of RTS determines how many jobs the queue can process in
-- parallel; each RTS can process one job at a time. You can\'t decrease
-- the number of RTS in your reserved queue. You can increase the number of
-- RTS by extending your existing commitment with a new 12-month commitment
-- for the larger number. The new commitment begins when you purchase the
-- additional capacity. You can\'t cancel your commitment or revert to your
-- original commitment after you increase the capacity.
--
-- 'renewalType', 'reservationPlanSettings_renewalType' - Specifies whether the term of your reserved queue pricing plan is
-- automatically extended (AUTO_RENEW) or expires (EXPIRE) at the end of
-- the term. When your term is auto renewed, you extend your commitment by
-- 12 months from the auto renew date. You can cancel this commitment.
newReservationPlanSettings ::
  -- | 'commitment'
  Commitment ->
  -- | 'reservedSlots'
  Prelude.Int ->
  -- | 'renewalType'
  RenewalType ->
  ReservationPlanSettings
newReservationPlanSettings :: Commitment -> Int -> RenewalType -> ReservationPlanSettings
newReservationPlanSettings
  Commitment
pCommitment_
  Int
pReservedSlots_
  RenewalType
pRenewalType_ =
    ReservationPlanSettings' :: Commitment -> Int -> RenewalType -> ReservationPlanSettings
ReservationPlanSettings'
      { $sel:commitment:ReservationPlanSettings' :: Commitment
commitment = Commitment
pCommitment_,
        $sel:reservedSlots:ReservationPlanSettings' :: Int
reservedSlots = Int
pReservedSlots_,
        $sel:renewalType:ReservationPlanSettings' :: RenewalType
renewalType = RenewalType
pRenewalType_
      }

-- | The length of the term of your reserved queue pricing plan commitment.
reservationPlanSettings_commitment :: Lens.Lens' ReservationPlanSettings Commitment
reservationPlanSettings_commitment :: (Commitment -> f Commitment)
-> ReservationPlanSettings -> f ReservationPlanSettings
reservationPlanSettings_commitment = (ReservationPlanSettings -> Commitment)
-> (ReservationPlanSettings
    -> Commitment -> ReservationPlanSettings)
-> Lens
     ReservationPlanSettings
     ReservationPlanSettings
     Commitment
     Commitment
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReservationPlanSettings' {Commitment
commitment :: Commitment
$sel:commitment:ReservationPlanSettings' :: ReservationPlanSettings -> Commitment
commitment} -> Commitment
commitment) (\s :: ReservationPlanSettings
s@ReservationPlanSettings' {} Commitment
a -> ReservationPlanSettings
s {$sel:commitment:ReservationPlanSettings' :: Commitment
commitment = Commitment
a} :: ReservationPlanSettings)

-- | Specifies the number of reserved transcode slots (RTS) for this queue.
-- The number of RTS determines how many jobs the queue can process in
-- parallel; each RTS can process one job at a time. You can\'t decrease
-- the number of RTS in your reserved queue. You can increase the number of
-- RTS by extending your existing commitment with a new 12-month commitment
-- for the larger number. The new commitment begins when you purchase the
-- additional capacity. You can\'t cancel your commitment or revert to your
-- original commitment after you increase the capacity.
reservationPlanSettings_reservedSlots :: Lens.Lens' ReservationPlanSettings Prelude.Int
reservationPlanSettings_reservedSlots :: (Int -> f Int)
-> ReservationPlanSettings -> f ReservationPlanSettings
reservationPlanSettings_reservedSlots = (ReservationPlanSettings -> Int)
-> (ReservationPlanSettings -> Int -> ReservationPlanSettings)
-> Lens ReservationPlanSettings ReservationPlanSettings Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReservationPlanSettings' {Int
reservedSlots :: Int
$sel:reservedSlots:ReservationPlanSettings' :: ReservationPlanSettings -> Int
reservedSlots} -> Int
reservedSlots) (\s :: ReservationPlanSettings
s@ReservationPlanSettings' {} Int
a -> ReservationPlanSettings
s {$sel:reservedSlots:ReservationPlanSettings' :: Int
reservedSlots = Int
a} :: ReservationPlanSettings)

-- | Specifies whether the term of your reserved queue pricing plan is
-- automatically extended (AUTO_RENEW) or expires (EXPIRE) at the end of
-- the term. When your term is auto renewed, you extend your commitment by
-- 12 months from the auto renew date. You can cancel this commitment.
reservationPlanSettings_renewalType :: Lens.Lens' ReservationPlanSettings RenewalType
reservationPlanSettings_renewalType :: (RenewalType -> f RenewalType)
-> ReservationPlanSettings -> f ReservationPlanSettings
reservationPlanSettings_renewalType = (ReservationPlanSettings -> RenewalType)
-> (ReservationPlanSettings
    -> RenewalType -> ReservationPlanSettings)
-> Lens
     ReservationPlanSettings
     ReservationPlanSettings
     RenewalType
     RenewalType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReservationPlanSettings' {RenewalType
renewalType :: RenewalType
$sel:renewalType:ReservationPlanSettings' :: ReservationPlanSettings -> RenewalType
renewalType} -> RenewalType
renewalType) (\s :: ReservationPlanSettings
s@ReservationPlanSettings' {} RenewalType
a -> ReservationPlanSettings
s {$sel:renewalType:ReservationPlanSettings' :: RenewalType
renewalType = RenewalType
a} :: ReservationPlanSettings)

instance Prelude.Hashable ReservationPlanSettings

instance Prelude.NFData ReservationPlanSettings

instance Core.ToJSON ReservationPlanSettings where
  toJSON :: ReservationPlanSettings -> Value
toJSON ReservationPlanSettings' {Int
Commitment
RenewalType
renewalType :: RenewalType
reservedSlots :: Int
commitment :: Commitment
$sel:renewalType:ReservationPlanSettings' :: ReservationPlanSettings -> RenewalType
$sel:reservedSlots:ReservationPlanSettings' :: ReservationPlanSettings -> Int
$sel:commitment:ReservationPlanSettings' :: ReservationPlanSettings -> Commitment
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"commitment" Text -> Commitment -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Commitment
commitment),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"reservedSlots" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Int
reservedSlots),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"renewalType" Text -> RenewalType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= RenewalType
renewalType)
          ]
      )