{-# 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.InputAttachment
-- 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.InputAttachment 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.AutomaticInputFailoverSettings
import Amazonka.MediaLive.Types.InputSettings
import qualified Amazonka.Prelude as Prelude

-- | Placeholder documentation for InputAttachment
--
-- /See:/ 'newInputAttachment' smart constructor.
data InputAttachment = InputAttachment'
  { -- | User-specified settings for defining what the conditions are for
    -- declaring the input unhealthy and failing over to a different input.
    InputAttachment -> Maybe AutomaticInputFailoverSettings
automaticInputFailoverSettings :: Prelude.Maybe AutomaticInputFailoverSettings,
    -- | User-specified name for the attachment. This is required if the user
    -- wants to use this input in an input switch action.
    InputAttachment -> Maybe Text
inputAttachmentName :: Prelude.Maybe Prelude.Text,
    -- | The ID of the input
    InputAttachment -> Maybe Text
inputId :: Prelude.Maybe Prelude.Text,
    -- | Settings of an input (caption selector, etc.)
    InputAttachment -> Maybe InputSettings
inputSettings :: Prelude.Maybe InputSettings
  }
  deriving (InputAttachment -> InputAttachment -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InputAttachment -> InputAttachment -> Bool
$c/= :: InputAttachment -> InputAttachment -> Bool
== :: InputAttachment -> InputAttachment -> Bool
$c== :: InputAttachment -> InputAttachment -> Bool
Prelude.Eq, ReadPrec [InputAttachment]
ReadPrec InputAttachment
Int -> ReadS InputAttachment
ReadS [InputAttachment]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InputAttachment]
$creadListPrec :: ReadPrec [InputAttachment]
readPrec :: ReadPrec InputAttachment
$creadPrec :: ReadPrec InputAttachment
readList :: ReadS [InputAttachment]
$creadList :: ReadS [InputAttachment]
readsPrec :: Int -> ReadS InputAttachment
$creadsPrec :: Int -> ReadS InputAttachment
Prelude.Read, Int -> InputAttachment -> ShowS
[InputAttachment] -> ShowS
InputAttachment -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InputAttachment] -> ShowS
$cshowList :: [InputAttachment] -> ShowS
show :: InputAttachment -> String
$cshow :: InputAttachment -> String
showsPrec :: Int -> InputAttachment -> ShowS
$cshowsPrec :: Int -> InputAttachment -> ShowS
Prelude.Show, forall x. Rep InputAttachment x -> InputAttachment
forall x. InputAttachment -> Rep InputAttachment x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InputAttachment x -> InputAttachment
$cfrom :: forall x. InputAttachment -> Rep InputAttachment x
Prelude.Generic)

-- |
-- Create a value of 'InputAttachment' 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:
--
-- 'automaticInputFailoverSettings', 'inputAttachment_automaticInputFailoverSettings' - User-specified settings for defining what the conditions are for
-- declaring the input unhealthy and failing over to a different input.
--
-- 'inputAttachmentName', 'inputAttachment_inputAttachmentName' - User-specified name for the attachment. This is required if the user
-- wants to use this input in an input switch action.
--
-- 'inputId', 'inputAttachment_inputId' - The ID of the input
--
-- 'inputSettings', 'inputAttachment_inputSettings' - Settings of an input (caption selector, etc.)
newInputAttachment ::
  InputAttachment
newInputAttachment :: InputAttachment
newInputAttachment =
  InputAttachment'
    { $sel:automaticInputFailoverSettings:InputAttachment' :: Maybe AutomaticInputFailoverSettings
automaticInputFailoverSettings =
        forall a. Maybe a
Prelude.Nothing,
      $sel:inputAttachmentName:InputAttachment' :: Maybe Text
inputAttachmentName = forall a. Maybe a
Prelude.Nothing,
      $sel:inputId:InputAttachment' :: Maybe Text
inputId = forall a. Maybe a
Prelude.Nothing,
      $sel:inputSettings:InputAttachment' :: Maybe InputSettings
inputSettings = forall a. Maybe a
Prelude.Nothing
    }

-- | User-specified settings for defining what the conditions are for
-- declaring the input unhealthy and failing over to a different input.
inputAttachment_automaticInputFailoverSettings :: Lens.Lens' InputAttachment (Prelude.Maybe AutomaticInputFailoverSettings)
inputAttachment_automaticInputFailoverSettings :: Lens' InputAttachment (Maybe AutomaticInputFailoverSettings)
inputAttachment_automaticInputFailoverSettings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputAttachment' {Maybe AutomaticInputFailoverSettings
automaticInputFailoverSettings :: Maybe AutomaticInputFailoverSettings
$sel:automaticInputFailoverSettings:InputAttachment' :: InputAttachment -> Maybe AutomaticInputFailoverSettings
automaticInputFailoverSettings} -> Maybe AutomaticInputFailoverSettings
automaticInputFailoverSettings) (\s :: InputAttachment
s@InputAttachment' {} Maybe AutomaticInputFailoverSettings
a -> InputAttachment
s {$sel:automaticInputFailoverSettings:InputAttachment' :: Maybe AutomaticInputFailoverSettings
automaticInputFailoverSettings = Maybe AutomaticInputFailoverSettings
a} :: InputAttachment)

-- | User-specified name for the attachment. This is required if the user
-- wants to use this input in an input switch action.
inputAttachment_inputAttachmentName :: Lens.Lens' InputAttachment (Prelude.Maybe Prelude.Text)
inputAttachment_inputAttachmentName :: Lens' InputAttachment (Maybe Text)
inputAttachment_inputAttachmentName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputAttachment' {Maybe Text
inputAttachmentName :: Maybe Text
$sel:inputAttachmentName:InputAttachment' :: InputAttachment -> Maybe Text
inputAttachmentName} -> Maybe Text
inputAttachmentName) (\s :: InputAttachment
s@InputAttachment' {} Maybe Text
a -> InputAttachment
s {$sel:inputAttachmentName:InputAttachment' :: Maybe Text
inputAttachmentName = Maybe Text
a} :: InputAttachment)

-- | The ID of the input
inputAttachment_inputId :: Lens.Lens' InputAttachment (Prelude.Maybe Prelude.Text)
inputAttachment_inputId :: Lens' InputAttachment (Maybe Text)
inputAttachment_inputId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputAttachment' {Maybe Text
inputId :: Maybe Text
$sel:inputId:InputAttachment' :: InputAttachment -> Maybe Text
inputId} -> Maybe Text
inputId) (\s :: InputAttachment
s@InputAttachment' {} Maybe Text
a -> InputAttachment
s {$sel:inputId:InputAttachment' :: Maybe Text
inputId = Maybe Text
a} :: InputAttachment)

-- | Settings of an input (caption selector, etc.)
inputAttachment_inputSettings :: Lens.Lens' InputAttachment (Prelude.Maybe InputSettings)
inputAttachment_inputSettings :: Lens' InputAttachment (Maybe InputSettings)
inputAttachment_inputSettings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputAttachment' {Maybe InputSettings
inputSettings :: Maybe InputSettings
$sel:inputSettings:InputAttachment' :: InputAttachment -> Maybe InputSettings
inputSettings} -> Maybe InputSettings
inputSettings) (\s :: InputAttachment
s@InputAttachment' {} Maybe InputSettings
a -> InputAttachment
s {$sel:inputSettings:InputAttachment' :: Maybe InputSettings
inputSettings = Maybe InputSettings
a} :: InputAttachment)

instance Data.FromJSON InputAttachment where
  parseJSON :: Value -> Parser InputAttachment
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"InputAttachment"
      ( \Object
x ->
          Maybe AutomaticInputFailoverSettings
-> Maybe Text
-> Maybe Text
-> Maybe InputSettings
-> InputAttachment
InputAttachment'
            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
"automaticInputFailoverSettings")
            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
"inputAttachmentName")
            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
"inputId")
            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
"inputSettings")
      )

instance Prelude.Hashable InputAttachment where
  hashWithSalt :: Int -> InputAttachment -> Int
hashWithSalt Int
_salt InputAttachment' {Maybe Text
Maybe AutomaticInputFailoverSettings
Maybe InputSettings
inputSettings :: Maybe InputSettings
inputId :: Maybe Text
inputAttachmentName :: Maybe Text
automaticInputFailoverSettings :: Maybe AutomaticInputFailoverSettings
$sel:inputSettings:InputAttachment' :: InputAttachment -> Maybe InputSettings
$sel:inputId:InputAttachment' :: InputAttachment -> Maybe Text
$sel:inputAttachmentName:InputAttachment' :: InputAttachment -> Maybe Text
$sel:automaticInputFailoverSettings:InputAttachment' :: InputAttachment -> Maybe AutomaticInputFailoverSettings
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AutomaticInputFailoverSettings
automaticInputFailoverSettings
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
inputAttachmentName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
inputId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe InputSettings
inputSettings

instance Prelude.NFData InputAttachment where
  rnf :: InputAttachment -> ()
rnf InputAttachment' {Maybe Text
Maybe AutomaticInputFailoverSettings
Maybe InputSettings
inputSettings :: Maybe InputSettings
inputId :: Maybe Text
inputAttachmentName :: Maybe Text
automaticInputFailoverSettings :: Maybe AutomaticInputFailoverSettings
$sel:inputSettings:InputAttachment' :: InputAttachment -> Maybe InputSettings
$sel:inputId:InputAttachment' :: InputAttachment -> Maybe Text
$sel:inputAttachmentName:InputAttachment' :: InputAttachment -> Maybe Text
$sel:automaticInputFailoverSettings:InputAttachment' :: InputAttachment -> Maybe AutomaticInputFailoverSettings
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe AutomaticInputFailoverSettings
automaticInputFailoverSettings
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
inputAttachmentName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
inputId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe InputSettings
inputSettings

instance Data.ToJSON InputAttachment where
  toJSON :: InputAttachment -> Value
toJSON InputAttachment' {Maybe Text
Maybe AutomaticInputFailoverSettings
Maybe InputSettings
inputSettings :: Maybe InputSettings
inputId :: Maybe Text
inputAttachmentName :: Maybe Text
automaticInputFailoverSettings :: Maybe AutomaticInputFailoverSettings
$sel:inputSettings:InputAttachment' :: InputAttachment -> Maybe InputSettings
$sel:inputId:InputAttachment' :: InputAttachment -> Maybe Text
$sel:inputAttachmentName:InputAttachment' :: InputAttachment -> Maybe Text
$sel:automaticInputFailoverSettings:InputAttachment' :: InputAttachment -> Maybe AutomaticInputFailoverSettings
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"automaticInputFailoverSettings" 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 AutomaticInputFailoverSettings
automaticInputFailoverSettings,
            (Key
"inputAttachmentName" 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
inputAttachmentName,
            (Key
"inputId" 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
inputId,
            (Key
"inputSettings" 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 InputSettings
inputSettings
          ]
      )