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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Slate VOD source configuration.
--
-- /See:/ 'newSlateSource' smart constructor.
data SlateSource = SlateSource'
  { -- | The name of the source location where the slate VOD source is stored.
    SlateSource -> Maybe Text
sourceLocationName :: Prelude.Maybe Prelude.Text,
    -- | The slate VOD source name. The VOD source must already exist in a source
    -- location before it can be used for slate.
    SlateSource -> Maybe Text
vodSourceName :: Prelude.Maybe Prelude.Text
  }
  deriving (SlateSource -> SlateSource -> Bool
(SlateSource -> SlateSource -> Bool)
-> (SlateSource -> SlateSource -> Bool) -> Eq SlateSource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SlateSource -> SlateSource -> Bool
$c/= :: SlateSource -> SlateSource -> Bool
== :: SlateSource -> SlateSource -> Bool
$c== :: SlateSource -> SlateSource -> Bool
Prelude.Eq, ReadPrec [SlateSource]
ReadPrec SlateSource
Int -> ReadS SlateSource
ReadS [SlateSource]
(Int -> ReadS SlateSource)
-> ReadS [SlateSource]
-> ReadPrec SlateSource
-> ReadPrec [SlateSource]
-> Read SlateSource
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SlateSource]
$creadListPrec :: ReadPrec [SlateSource]
readPrec :: ReadPrec SlateSource
$creadPrec :: ReadPrec SlateSource
readList :: ReadS [SlateSource]
$creadList :: ReadS [SlateSource]
readsPrec :: Int -> ReadS SlateSource
$creadsPrec :: Int -> ReadS SlateSource
Prelude.Read, Int -> SlateSource -> ShowS
[SlateSource] -> ShowS
SlateSource -> String
(Int -> SlateSource -> ShowS)
-> (SlateSource -> String)
-> ([SlateSource] -> ShowS)
-> Show SlateSource
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SlateSource] -> ShowS
$cshowList :: [SlateSource] -> ShowS
show :: SlateSource -> String
$cshow :: SlateSource -> String
showsPrec :: Int -> SlateSource -> ShowS
$cshowsPrec :: Int -> SlateSource -> ShowS
Prelude.Show, (forall x. SlateSource -> Rep SlateSource x)
-> (forall x. Rep SlateSource x -> SlateSource)
-> Generic SlateSource
forall x. Rep SlateSource x -> SlateSource
forall x. SlateSource -> Rep SlateSource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SlateSource x -> SlateSource
$cfrom :: forall x. SlateSource -> Rep SlateSource x
Prelude.Generic)

-- |
-- Create a value of 'SlateSource' 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:
--
-- 'sourceLocationName', 'slateSource_sourceLocationName' - The name of the source location where the slate VOD source is stored.
--
-- 'vodSourceName', 'slateSource_vodSourceName' - The slate VOD source name. The VOD source must already exist in a source
-- location before it can be used for slate.
newSlateSource ::
  SlateSource
newSlateSource :: SlateSource
newSlateSource =
  SlateSource' :: Maybe Text -> Maybe Text -> SlateSource
SlateSource'
    { $sel:sourceLocationName:SlateSource' :: Maybe Text
sourceLocationName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:vodSourceName:SlateSource' :: Maybe Text
vodSourceName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the source location where the slate VOD source is stored.
slateSource_sourceLocationName :: Lens.Lens' SlateSource (Prelude.Maybe Prelude.Text)
slateSource_sourceLocationName :: (Maybe Text -> f (Maybe Text)) -> SlateSource -> f SlateSource
slateSource_sourceLocationName = (SlateSource -> Maybe Text)
-> (SlateSource -> Maybe Text -> SlateSource)
-> Lens SlateSource SlateSource (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SlateSource' {Maybe Text
sourceLocationName :: Maybe Text
$sel:sourceLocationName:SlateSource' :: SlateSource -> Maybe Text
sourceLocationName} -> Maybe Text
sourceLocationName) (\s :: SlateSource
s@SlateSource' {} Maybe Text
a -> SlateSource
s {$sel:sourceLocationName:SlateSource' :: Maybe Text
sourceLocationName = Maybe Text
a} :: SlateSource)

-- | The slate VOD source name. The VOD source must already exist in a source
-- location before it can be used for slate.
slateSource_vodSourceName :: Lens.Lens' SlateSource (Prelude.Maybe Prelude.Text)
slateSource_vodSourceName :: (Maybe Text -> f (Maybe Text)) -> SlateSource -> f SlateSource
slateSource_vodSourceName = (SlateSource -> Maybe Text)
-> (SlateSource -> Maybe Text -> SlateSource)
-> Lens SlateSource SlateSource (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SlateSource' {Maybe Text
vodSourceName :: Maybe Text
$sel:vodSourceName:SlateSource' :: SlateSource -> Maybe Text
vodSourceName} -> Maybe Text
vodSourceName) (\s :: SlateSource
s@SlateSource' {} Maybe Text
a -> SlateSource
s {$sel:vodSourceName:SlateSource' :: Maybe Text
vodSourceName = Maybe Text
a} :: SlateSource)

instance Core.FromJSON SlateSource where
  parseJSON :: Value -> Parser SlateSource
parseJSON =
    String
-> (Object -> Parser SlateSource) -> Value -> Parser SlateSource
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SlateSource"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> SlateSource
SlateSource'
            (Maybe Text -> Maybe Text -> SlateSource)
-> Parser (Maybe Text) -> Parser (Maybe Text -> SlateSource)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SourceLocationName")
            Parser (Maybe Text -> SlateSource)
-> Parser (Maybe Text) -> Parser SlateSource
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"VodSourceName")
      )

instance Prelude.Hashable SlateSource

instance Prelude.NFData SlateSource

instance Core.ToJSON SlateSource where
  toJSON :: SlateSource -> Value
toJSON SlateSource' {Maybe Text
vodSourceName :: Maybe Text
sourceLocationName :: Maybe Text
$sel:vodSourceName:SlateSource' :: SlateSource -> Maybe Text
$sel:sourceLocationName:SlateSource' :: SlateSource -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"SourceLocationName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
sourceLocationName,
            (Text
"VodSourceName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
vodSourceName
          ]
      )