{-# 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.MediaTailor.Types.ScheduleConfiguration
-- 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.MediaTailor.Types.ScheduleConfiguration where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaTailor.Types.Transition
import qualified Amazonka.Prelude as Prelude

-- | Schedule configuration parameters. A channel must be stopped before
-- changes can be made to the schedule.
--
-- /See:/ 'newScheduleConfiguration' smart constructor.
data ScheduleConfiguration = ScheduleConfiguration'
  { -- | Program transition configurations.
    ScheduleConfiguration -> Transition
transition :: Transition
  }
  deriving (ScheduleConfiguration -> ScheduleConfiguration -> Bool
(ScheduleConfiguration -> ScheduleConfiguration -> Bool)
-> (ScheduleConfiguration -> ScheduleConfiguration -> Bool)
-> Eq ScheduleConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ScheduleConfiguration -> ScheduleConfiguration -> Bool
$c/= :: ScheduleConfiguration -> ScheduleConfiguration -> Bool
== :: ScheduleConfiguration -> ScheduleConfiguration -> Bool
$c== :: ScheduleConfiguration -> ScheduleConfiguration -> Bool
Prelude.Eq, ReadPrec [ScheduleConfiguration]
ReadPrec ScheduleConfiguration
Int -> ReadS ScheduleConfiguration
ReadS [ScheduleConfiguration]
(Int -> ReadS ScheduleConfiguration)
-> ReadS [ScheduleConfiguration]
-> ReadPrec ScheduleConfiguration
-> ReadPrec [ScheduleConfiguration]
-> Read ScheduleConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ScheduleConfiguration]
$creadListPrec :: ReadPrec [ScheduleConfiguration]
readPrec :: ReadPrec ScheduleConfiguration
$creadPrec :: ReadPrec ScheduleConfiguration
readList :: ReadS [ScheduleConfiguration]
$creadList :: ReadS [ScheduleConfiguration]
readsPrec :: Int -> ReadS ScheduleConfiguration
$creadsPrec :: Int -> ReadS ScheduleConfiguration
Prelude.Read, Int -> ScheduleConfiguration -> ShowS
[ScheduleConfiguration] -> ShowS
ScheduleConfiguration -> String
(Int -> ScheduleConfiguration -> ShowS)
-> (ScheduleConfiguration -> String)
-> ([ScheduleConfiguration] -> ShowS)
-> Show ScheduleConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ScheduleConfiguration] -> ShowS
$cshowList :: [ScheduleConfiguration] -> ShowS
show :: ScheduleConfiguration -> String
$cshow :: ScheduleConfiguration -> String
showsPrec :: Int -> ScheduleConfiguration -> ShowS
$cshowsPrec :: Int -> ScheduleConfiguration -> ShowS
Prelude.Show, (forall x. ScheduleConfiguration -> Rep ScheduleConfiguration x)
-> (forall x. Rep ScheduleConfiguration x -> ScheduleConfiguration)
-> Generic ScheduleConfiguration
forall x. Rep ScheduleConfiguration x -> ScheduleConfiguration
forall x. ScheduleConfiguration -> Rep ScheduleConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ScheduleConfiguration x -> ScheduleConfiguration
$cfrom :: forall x. ScheduleConfiguration -> Rep ScheduleConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'ScheduleConfiguration' 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:
--
-- 'transition', 'scheduleConfiguration_transition' - Program transition configurations.
newScheduleConfiguration ::
  -- | 'transition'
  Transition ->
  ScheduleConfiguration
newScheduleConfiguration :: Transition -> ScheduleConfiguration
newScheduleConfiguration Transition
pTransition_ =
  ScheduleConfiguration' :: Transition -> ScheduleConfiguration
ScheduleConfiguration' {$sel:transition:ScheduleConfiguration' :: Transition
transition = Transition
pTransition_}

-- | Program transition configurations.
scheduleConfiguration_transition :: Lens.Lens' ScheduleConfiguration Transition
scheduleConfiguration_transition :: (Transition -> f Transition)
-> ScheduleConfiguration -> f ScheduleConfiguration
scheduleConfiguration_transition = (ScheduleConfiguration -> Transition)
-> (ScheduleConfiguration -> Transition -> ScheduleConfiguration)
-> Lens
     ScheduleConfiguration ScheduleConfiguration Transition Transition
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduleConfiguration' {Transition
transition :: Transition
$sel:transition:ScheduleConfiguration' :: ScheduleConfiguration -> Transition
transition} -> Transition
transition) (\s :: ScheduleConfiguration
s@ScheduleConfiguration' {} Transition
a -> ScheduleConfiguration
s {$sel:transition:ScheduleConfiguration' :: Transition
transition = Transition
a} :: ScheduleConfiguration)

instance Prelude.Hashable ScheduleConfiguration

instance Prelude.NFData ScheduleConfiguration

instance Core.ToJSON ScheduleConfiguration where
  toJSON :: ScheduleConfiguration -> Value
toJSON ScheduleConfiguration' {Transition
transition :: Transition
$sel:transition:ScheduleConfiguration' :: ScheduleConfiguration -> Transition
..} =
    [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
"Transition" Text -> Transition -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Transition
transition)]
      )