{-# 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.MediaLive.Types.InputSwitchScheduleActionSettings
-- 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.MediaLive.Types.InputSwitchScheduleActionSettings where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MediaLive.Types.InputClippingSettings
import qualified Amazonka.Prelude as Prelude

-- | Settings for the \"switch input\" action: to switch from ingesting one
-- input to ingesting another input.
--
-- /See:/ 'newInputSwitchScheduleActionSettings' smart constructor.
data InputSwitchScheduleActionSettings = InputSwitchScheduleActionSettings'
  { -- | Settings to let you create a clip of the file input, in order to set up
    -- the input to ingest only a portion of the file.
    InputSwitchScheduleActionSettings -> Maybe InputClippingSettings
inputClippingSettings :: Prelude.Maybe InputClippingSettings,
    -- | The value for the variable portion of the URL for the dynamic input, for
    -- this instance of the input. Each time you use the same dynamic input in
    -- an input switch action, you can provide a different value, in order to
    -- connect the input to a different content source.
    InputSwitchScheduleActionSettings -> Maybe [Text]
urlPath :: Prelude.Maybe [Prelude.Text],
    -- | The name of the input attachment (not the name of the input!) to switch
    -- to. The name is specified in the channel configuration.
    InputSwitchScheduleActionSettings -> Text
inputAttachmentNameReference :: Prelude.Text
  }
  deriving (InputSwitchScheduleActionSettings
-> InputSwitchScheduleActionSettings -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InputSwitchScheduleActionSettings
-> InputSwitchScheduleActionSettings -> Bool
$c/= :: InputSwitchScheduleActionSettings
-> InputSwitchScheduleActionSettings -> Bool
== :: InputSwitchScheduleActionSettings
-> InputSwitchScheduleActionSettings -> Bool
$c== :: InputSwitchScheduleActionSettings
-> InputSwitchScheduleActionSettings -> Bool
Prelude.Eq, ReadPrec [InputSwitchScheduleActionSettings]
ReadPrec InputSwitchScheduleActionSettings
Int -> ReadS InputSwitchScheduleActionSettings
ReadS [InputSwitchScheduleActionSettings]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InputSwitchScheduleActionSettings]
$creadListPrec :: ReadPrec [InputSwitchScheduleActionSettings]
readPrec :: ReadPrec InputSwitchScheduleActionSettings
$creadPrec :: ReadPrec InputSwitchScheduleActionSettings
readList :: ReadS [InputSwitchScheduleActionSettings]
$creadList :: ReadS [InputSwitchScheduleActionSettings]
readsPrec :: Int -> ReadS InputSwitchScheduleActionSettings
$creadsPrec :: Int -> ReadS InputSwitchScheduleActionSettings
Prelude.Read, Int -> InputSwitchScheduleActionSettings -> ShowS
[InputSwitchScheduleActionSettings] -> ShowS
InputSwitchScheduleActionSettings -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InputSwitchScheduleActionSettings] -> ShowS
$cshowList :: [InputSwitchScheduleActionSettings] -> ShowS
show :: InputSwitchScheduleActionSettings -> String
$cshow :: InputSwitchScheduleActionSettings -> String
showsPrec :: Int -> InputSwitchScheduleActionSettings -> ShowS
$cshowsPrec :: Int -> InputSwitchScheduleActionSettings -> ShowS
Prelude.Show, forall x.
Rep InputSwitchScheduleActionSettings x
-> InputSwitchScheduleActionSettings
forall x.
InputSwitchScheduleActionSettings
-> Rep InputSwitchScheduleActionSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep InputSwitchScheduleActionSettings x
-> InputSwitchScheduleActionSettings
$cfrom :: forall x.
InputSwitchScheduleActionSettings
-> Rep InputSwitchScheduleActionSettings x
Prelude.Generic)

-- |
-- Create a value of 'InputSwitchScheduleActionSettings' 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:
--
-- 'inputClippingSettings', 'inputSwitchScheduleActionSettings_inputClippingSettings' - Settings to let you create a clip of the file input, in order to set up
-- the input to ingest only a portion of the file.
--
-- 'urlPath', 'inputSwitchScheduleActionSettings_urlPath' - The value for the variable portion of the URL for the dynamic input, for
-- this instance of the input. Each time you use the same dynamic input in
-- an input switch action, you can provide a different value, in order to
-- connect the input to a different content source.
--
-- 'inputAttachmentNameReference', 'inputSwitchScheduleActionSettings_inputAttachmentNameReference' - The name of the input attachment (not the name of the input!) to switch
-- to. The name is specified in the channel configuration.
newInputSwitchScheduleActionSettings ::
  -- | 'inputAttachmentNameReference'
  Prelude.Text ->
  InputSwitchScheduleActionSettings
newInputSwitchScheduleActionSettings :: Text -> InputSwitchScheduleActionSettings
newInputSwitchScheduleActionSettings
  Text
pInputAttachmentNameReference_ =
    InputSwitchScheduleActionSettings'
      { $sel:inputClippingSettings:InputSwitchScheduleActionSettings' :: Maybe InputClippingSettings
inputClippingSettings =
          forall a. Maybe a
Prelude.Nothing,
        $sel:urlPath:InputSwitchScheduleActionSettings' :: Maybe [Text]
urlPath = forall a. Maybe a
Prelude.Nothing,
        $sel:inputAttachmentNameReference:InputSwitchScheduleActionSettings' :: Text
inputAttachmentNameReference =
          Text
pInputAttachmentNameReference_
      }

-- | Settings to let you create a clip of the file input, in order to set up
-- the input to ingest only a portion of the file.
inputSwitchScheduleActionSettings_inputClippingSettings :: Lens.Lens' InputSwitchScheduleActionSettings (Prelude.Maybe InputClippingSettings)
inputSwitchScheduleActionSettings_inputClippingSettings :: Lens'
  InputSwitchScheduleActionSettings (Maybe InputClippingSettings)
inputSwitchScheduleActionSettings_inputClippingSettings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputSwitchScheduleActionSettings' {Maybe InputClippingSettings
inputClippingSettings :: Maybe InputClippingSettings
$sel:inputClippingSettings:InputSwitchScheduleActionSettings' :: InputSwitchScheduleActionSettings -> Maybe InputClippingSettings
inputClippingSettings} -> Maybe InputClippingSettings
inputClippingSettings) (\s :: InputSwitchScheduleActionSettings
s@InputSwitchScheduleActionSettings' {} Maybe InputClippingSettings
a -> InputSwitchScheduleActionSettings
s {$sel:inputClippingSettings:InputSwitchScheduleActionSettings' :: Maybe InputClippingSettings
inputClippingSettings = Maybe InputClippingSettings
a} :: InputSwitchScheduleActionSettings)

-- | The value for the variable portion of the URL for the dynamic input, for
-- this instance of the input. Each time you use the same dynamic input in
-- an input switch action, you can provide a different value, in order to
-- connect the input to a different content source.
inputSwitchScheduleActionSettings_urlPath :: Lens.Lens' InputSwitchScheduleActionSettings (Prelude.Maybe [Prelude.Text])
inputSwitchScheduleActionSettings_urlPath :: Lens' InputSwitchScheduleActionSettings (Maybe [Text])
inputSwitchScheduleActionSettings_urlPath = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputSwitchScheduleActionSettings' {Maybe [Text]
urlPath :: Maybe [Text]
$sel:urlPath:InputSwitchScheduleActionSettings' :: InputSwitchScheduleActionSettings -> Maybe [Text]
urlPath} -> Maybe [Text]
urlPath) (\s :: InputSwitchScheduleActionSettings
s@InputSwitchScheduleActionSettings' {} Maybe [Text]
a -> InputSwitchScheduleActionSettings
s {$sel:urlPath:InputSwitchScheduleActionSettings' :: Maybe [Text]
urlPath = Maybe [Text]
a} :: InputSwitchScheduleActionSettings) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of the input attachment (not the name of the input!) to switch
-- to. The name is specified in the channel configuration.
inputSwitchScheduleActionSettings_inputAttachmentNameReference :: Lens.Lens' InputSwitchScheduleActionSettings Prelude.Text
inputSwitchScheduleActionSettings_inputAttachmentNameReference :: Lens' InputSwitchScheduleActionSettings Text
inputSwitchScheduleActionSettings_inputAttachmentNameReference = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputSwitchScheduleActionSettings' {Text
inputAttachmentNameReference :: Text
$sel:inputAttachmentNameReference:InputSwitchScheduleActionSettings' :: InputSwitchScheduleActionSettings -> Text
inputAttachmentNameReference} -> Text
inputAttachmentNameReference) (\s :: InputSwitchScheduleActionSettings
s@InputSwitchScheduleActionSettings' {} Text
a -> InputSwitchScheduleActionSettings
s {$sel:inputAttachmentNameReference:InputSwitchScheduleActionSettings' :: Text
inputAttachmentNameReference = Text
a} :: InputSwitchScheduleActionSettings)

instance
  Data.FromJSON
    InputSwitchScheduleActionSettings
  where
  parseJSON :: Value -> Parser InputSwitchScheduleActionSettings
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"InputSwitchScheduleActionSettings"
      ( \Object
x ->
          Maybe InputClippingSettings
-> Maybe [Text] -> Text -> InputSwitchScheduleActionSettings
InputSwitchScheduleActionSettings'
            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
"inputClippingSettings")
            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
"urlPath" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"inputAttachmentNameReference")
      )

instance
  Prelude.Hashable
    InputSwitchScheduleActionSettings
  where
  hashWithSalt :: Int -> InputSwitchScheduleActionSettings -> Int
hashWithSalt
    Int
_salt
    InputSwitchScheduleActionSettings' {Maybe [Text]
Maybe InputClippingSettings
Text
inputAttachmentNameReference :: Text
urlPath :: Maybe [Text]
inputClippingSettings :: Maybe InputClippingSettings
$sel:inputAttachmentNameReference:InputSwitchScheduleActionSettings' :: InputSwitchScheduleActionSettings -> Text
$sel:urlPath:InputSwitchScheduleActionSettings' :: InputSwitchScheduleActionSettings -> Maybe [Text]
$sel:inputClippingSettings:InputSwitchScheduleActionSettings' :: InputSwitchScheduleActionSettings -> Maybe InputClippingSettings
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe InputClippingSettings
inputClippingSettings
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
urlPath
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
inputAttachmentNameReference

instance
  Prelude.NFData
    InputSwitchScheduleActionSettings
  where
  rnf :: InputSwitchScheduleActionSettings -> ()
rnf InputSwitchScheduleActionSettings' {Maybe [Text]
Maybe InputClippingSettings
Text
inputAttachmentNameReference :: Text
urlPath :: Maybe [Text]
inputClippingSettings :: Maybe InputClippingSettings
$sel:inputAttachmentNameReference:InputSwitchScheduleActionSettings' :: InputSwitchScheduleActionSettings -> Text
$sel:urlPath:InputSwitchScheduleActionSettings' :: InputSwitchScheduleActionSettings -> Maybe [Text]
$sel:inputClippingSettings:InputSwitchScheduleActionSettings' :: InputSwitchScheduleActionSettings -> Maybe InputClippingSettings
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe InputClippingSettings
inputClippingSettings
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
urlPath
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
inputAttachmentNameReference

instance
  Data.ToJSON
    InputSwitchScheduleActionSettings
  where
  toJSON :: InputSwitchScheduleActionSettings -> Value
toJSON InputSwitchScheduleActionSettings' {Maybe [Text]
Maybe InputClippingSettings
Text
inputAttachmentNameReference :: Text
urlPath :: Maybe [Text]
inputClippingSettings :: Maybe InputClippingSettings
$sel:inputAttachmentNameReference:InputSwitchScheduleActionSettings' :: InputSwitchScheduleActionSettings -> Text
$sel:urlPath:InputSwitchScheduleActionSettings' :: InputSwitchScheduleActionSettings -> Maybe [Text]
$sel:inputClippingSettings:InputSwitchScheduleActionSettings' :: InputSwitchScheduleActionSettings -> Maybe InputClippingSettings
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"inputClippingSettings" 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 InputClippingSettings
inputClippingSettings,
            (Key
"urlPath" 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]
urlPath,
            forall a. a -> Maybe a
Prelude.Just
              ( Key
"inputAttachmentNameReference"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
inputAttachmentNameReference
              )
          ]
      )