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

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

-- | Frame Capture Output Settings
--
-- /See:/ 'newFrameCaptureOutputSettings' smart constructor.
data FrameCaptureOutputSettings = FrameCaptureOutputSettings'
  { -- | Required if the output group contains more than one output. This
    -- modifier forms part of the output file name.
    FrameCaptureOutputSettings -> Maybe Text
nameModifier :: Prelude.Maybe Prelude.Text
  }
  deriving (FrameCaptureOutputSettings -> FrameCaptureOutputSettings -> Bool
(FrameCaptureOutputSettings -> FrameCaptureOutputSettings -> Bool)
-> (FrameCaptureOutputSettings
    -> FrameCaptureOutputSettings -> Bool)
-> Eq FrameCaptureOutputSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FrameCaptureOutputSettings -> FrameCaptureOutputSettings -> Bool
$c/= :: FrameCaptureOutputSettings -> FrameCaptureOutputSettings -> Bool
== :: FrameCaptureOutputSettings -> FrameCaptureOutputSettings -> Bool
$c== :: FrameCaptureOutputSettings -> FrameCaptureOutputSettings -> Bool
Prelude.Eq, ReadPrec [FrameCaptureOutputSettings]
ReadPrec FrameCaptureOutputSettings
Int -> ReadS FrameCaptureOutputSettings
ReadS [FrameCaptureOutputSettings]
(Int -> ReadS FrameCaptureOutputSettings)
-> ReadS [FrameCaptureOutputSettings]
-> ReadPrec FrameCaptureOutputSettings
-> ReadPrec [FrameCaptureOutputSettings]
-> Read FrameCaptureOutputSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FrameCaptureOutputSettings]
$creadListPrec :: ReadPrec [FrameCaptureOutputSettings]
readPrec :: ReadPrec FrameCaptureOutputSettings
$creadPrec :: ReadPrec FrameCaptureOutputSettings
readList :: ReadS [FrameCaptureOutputSettings]
$creadList :: ReadS [FrameCaptureOutputSettings]
readsPrec :: Int -> ReadS FrameCaptureOutputSettings
$creadsPrec :: Int -> ReadS FrameCaptureOutputSettings
Prelude.Read, Int -> FrameCaptureOutputSettings -> ShowS
[FrameCaptureOutputSettings] -> ShowS
FrameCaptureOutputSettings -> String
(Int -> FrameCaptureOutputSettings -> ShowS)
-> (FrameCaptureOutputSettings -> String)
-> ([FrameCaptureOutputSettings] -> ShowS)
-> Show FrameCaptureOutputSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FrameCaptureOutputSettings] -> ShowS
$cshowList :: [FrameCaptureOutputSettings] -> ShowS
show :: FrameCaptureOutputSettings -> String
$cshow :: FrameCaptureOutputSettings -> String
showsPrec :: Int -> FrameCaptureOutputSettings -> ShowS
$cshowsPrec :: Int -> FrameCaptureOutputSettings -> ShowS
Prelude.Show, (forall x.
 FrameCaptureOutputSettings -> Rep FrameCaptureOutputSettings x)
-> (forall x.
    Rep FrameCaptureOutputSettings x -> FrameCaptureOutputSettings)
-> Generic FrameCaptureOutputSettings
forall x.
Rep FrameCaptureOutputSettings x -> FrameCaptureOutputSettings
forall x.
FrameCaptureOutputSettings -> Rep FrameCaptureOutputSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep FrameCaptureOutputSettings x -> FrameCaptureOutputSettings
$cfrom :: forall x.
FrameCaptureOutputSettings -> Rep FrameCaptureOutputSettings x
Prelude.Generic)

-- |
-- Create a value of 'FrameCaptureOutputSettings' 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:
--
-- 'nameModifier', 'frameCaptureOutputSettings_nameModifier' - Required if the output group contains more than one output. This
-- modifier forms part of the output file name.
newFrameCaptureOutputSettings ::
  FrameCaptureOutputSettings
newFrameCaptureOutputSettings :: FrameCaptureOutputSettings
newFrameCaptureOutputSettings =
  FrameCaptureOutputSettings' :: Maybe Text -> FrameCaptureOutputSettings
FrameCaptureOutputSettings'
    { $sel:nameModifier:FrameCaptureOutputSettings' :: Maybe Text
nameModifier =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Required if the output group contains more than one output. This
-- modifier forms part of the output file name.
frameCaptureOutputSettings_nameModifier :: Lens.Lens' FrameCaptureOutputSettings (Prelude.Maybe Prelude.Text)
frameCaptureOutputSettings_nameModifier :: (Maybe Text -> f (Maybe Text))
-> FrameCaptureOutputSettings -> f FrameCaptureOutputSettings
frameCaptureOutputSettings_nameModifier = (FrameCaptureOutputSettings -> Maybe Text)
-> (FrameCaptureOutputSettings
    -> Maybe Text -> FrameCaptureOutputSettings)
-> Lens
     FrameCaptureOutputSettings
     FrameCaptureOutputSettings
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FrameCaptureOutputSettings' {Maybe Text
nameModifier :: Maybe Text
$sel:nameModifier:FrameCaptureOutputSettings' :: FrameCaptureOutputSettings -> Maybe Text
nameModifier} -> Maybe Text
nameModifier) (\s :: FrameCaptureOutputSettings
s@FrameCaptureOutputSettings' {} Maybe Text
a -> FrameCaptureOutputSettings
s {$sel:nameModifier:FrameCaptureOutputSettings' :: Maybe Text
nameModifier = Maybe Text
a} :: FrameCaptureOutputSettings)

instance Core.FromJSON FrameCaptureOutputSettings where
  parseJSON :: Value -> Parser FrameCaptureOutputSettings
parseJSON =
    String
-> (Object -> Parser FrameCaptureOutputSettings)
-> Value
-> Parser FrameCaptureOutputSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"FrameCaptureOutputSettings"
      ( \Object
x ->
          Maybe Text -> FrameCaptureOutputSettings
FrameCaptureOutputSettings'
            (Maybe Text -> FrameCaptureOutputSettings)
-> Parser (Maybe Text) -> Parser FrameCaptureOutputSettings
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
"nameModifier")
      )

instance Prelude.Hashable FrameCaptureOutputSettings

instance Prelude.NFData FrameCaptureOutputSettings

instance Core.ToJSON FrameCaptureOutputSettings where
  toJSON :: FrameCaptureOutputSettings -> Value
toJSON FrameCaptureOutputSettings' {Maybe Text
nameModifier :: Maybe Text
$sel:nameModifier:FrameCaptureOutputSettings' :: FrameCaptureOutputSettings -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"nameModifier" 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
nameModifier]
      )