{-# 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.FrameCaptureGroupSettings
-- 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.FrameCaptureGroupSettings 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.FrameCaptureCdnSettings
import Amazonka.MediaLive.Types.OutputLocationRef
import qualified Amazonka.Prelude as Prelude

-- | Frame Capture Group Settings
--
-- /See:/ 'newFrameCaptureGroupSettings' smart constructor.
data FrameCaptureGroupSettings = FrameCaptureGroupSettings'
  { -- | Parameters that control interactions with the CDN.
    FrameCaptureGroupSettings -> Maybe FrameCaptureCdnSettings
frameCaptureCdnSettings :: Prelude.Maybe FrameCaptureCdnSettings,
    -- | The destination for the frame capture files. Either the URI for an
    -- Amazon S3 bucket and object, plus a file name prefix (for example,
    -- s3ssl:\/\/sportsDelivery\/highlights\/20180820\/curling-) or the URI for
    -- a MediaStore container, plus a file name prefix (for example,
    -- mediastoressl:\/\/sportsDelivery\/20180820\/curling-). The final file
    -- names consist of the prefix from the destination field (for example,
    -- \"curling-\") + name modifier + the counter (5 digits, starting from
    -- 00001) + extension (which is always .jpg). For example,
    -- curling-low.00001.jpg
    FrameCaptureGroupSettings -> OutputLocationRef
destination :: OutputLocationRef
  }
  deriving (FrameCaptureGroupSettings -> FrameCaptureGroupSettings -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FrameCaptureGroupSettings -> FrameCaptureGroupSettings -> Bool
$c/= :: FrameCaptureGroupSettings -> FrameCaptureGroupSettings -> Bool
== :: FrameCaptureGroupSettings -> FrameCaptureGroupSettings -> Bool
$c== :: FrameCaptureGroupSettings -> FrameCaptureGroupSettings -> Bool
Prelude.Eq, ReadPrec [FrameCaptureGroupSettings]
ReadPrec FrameCaptureGroupSettings
Int -> ReadS FrameCaptureGroupSettings
ReadS [FrameCaptureGroupSettings]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FrameCaptureGroupSettings]
$creadListPrec :: ReadPrec [FrameCaptureGroupSettings]
readPrec :: ReadPrec FrameCaptureGroupSettings
$creadPrec :: ReadPrec FrameCaptureGroupSettings
readList :: ReadS [FrameCaptureGroupSettings]
$creadList :: ReadS [FrameCaptureGroupSettings]
readsPrec :: Int -> ReadS FrameCaptureGroupSettings
$creadsPrec :: Int -> ReadS FrameCaptureGroupSettings
Prelude.Read, Int -> FrameCaptureGroupSettings -> ShowS
[FrameCaptureGroupSettings] -> ShowS
FrameCaptureGroupSettings -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FrameCaptureGroupSettings] -> ShowS
$cshowList :: [FrameCaptureGroupSettings] -> ShowS
show :: FrameCaptureGroupSettings -> String
$cshow :: FrameCaptureGroupSettings -> String
showsPrec :: Int -> FrameCaptureGroupSettings -> ShowS
$cshowsPrec :: Int -> FrameCaptureGroupSettings -> ShowS
Prelude.Show, forall x.
Rep FrameCaptureGroupSettings x -> FrameCaptureGroupSettings
forall x.
FrameCaptureGroupSettings -> Rep FrameCaptureGroupSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep FrameCaptureGroupSettings x -> FrameCaptureGroupSettings
$cfrom :: forall x.
FrameCaptureGroupSettings -> Rep FrameCaptureGroupSettings x
Prelude.Generic)

-- |
-- Create a value of 'FrameCaptureGroupSettings' 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:
--
-- 'frameCaptureCdnSettings', 'frameCaptureGroupSettings_frameCaptureCdnSettings' - Parameters that control interactions with the CDN.
--
-- 'destination', 'frameCaptureGroupSettings_destination' - The destination for the frame capture files. Either the URI for an
-- Amazon S3 bucket and object, plus a file name prefix (for example,
-- s3ssl:\/\/sportsDelivery\/highlights\/20180820\/curling-) or the URI for
-- a MediaStore container, plus a file name prefix (for example,
-- mediastoressl:\/\/sportsDelivery\/20180820\/curling-). The final file
-- names consist of the prefix from the destination field (for example,
-- \"curling-\") + name modifier + the counter (5 digits, starting from
-- 00001) + extension (which is always .jpg). For example,
-- curling-low.00001.jpg
newFrameCaptureGroupSettings ::
  -- | 'destination'
  OutputLocationRef ->
  FrameCaptureGroupSettings
newFrameCaptureGroupSettings :: OutputLocationRef -> FrameCaptureGroupSettings
newFrameCaptureGroupSettings OutputLocationRef
pDestination_ =
  FrameCaptureGroupSettings'
    { $sel:frameCaptureCdnSettings:FrameCaptureGroupSettings' :: Maybe FrameCaptureCdnSettings
frameCaptureCdnSettings =
        forall a. Maybe a
Prelude.Nothing,
      $sel:destination:FrameCaptureGroupSettings' :: OutputLocationRef
destination = OutputLocationRef
pDestination_
    }

-- | Parameters that control interactions with the CDN.
frameCaptureGroupSettings_frameCaptureCdnSettings :: Lens.Lens' FrameCaptureGroupSettings (Prelude.Maybe FrameCaptureCdnSettings)
frameCaptureGroupSettings_frameCaptureCdnSettings :: Lens' FrameCaptureGroupSettings (Maybe FrameCaptureCdnSettings)
frameCaptureGroupSettings_frameCaptureCdnSettings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FrameCaptureGroupSettings' {Maybe FrameCaptureCdnSettings
frameCaptureCdnSettings :: Maybe FrameCaptureCdnSettings
$sel:frameCaptureCdnSettings:FrameCaptureGroupSettings' :: FrameCaptureGroupSettings -> Maybe FrameCaptureCdnSettings
frameCaptureCdnSettings} -> Maybe FrameCaptureCdnSettings
frameCaptureCdnSettings) (\s :: FrameCaptureGroupSettings
s@FrameCaptureGroupSettings' {} Maybe FrameCaptureCdnSettings
a -> FrameCaptureGroupSettings
s {$sel:frameCaptureCdnSettings:FrameCaptureGroupSettings' :: Maybe FrameCaptureCdnSettings
frameCaptureCdnSettings = Maybe FrameCaptureCdnSettings
a} :: FrameCaptureGroupSettings)

-- | The destination for the frame capture files. Either the URI for an
-- Amazon S3 bucket and object, plus a file name prefix (for example,
-- s3ssl:\/\/sportsDelivery\/highlights\/20180820\/curling-) or the URI for
-- a MediaStore container, plus a file name prefix (for example,
-- mediastoressl:\/\/sportsDelivery\/20180820\/curling-). The final file
-- names consist of the prefix from the destination field (for example,
-- \"curling-\") + name modifier + the counter (5 digits, starting from
-- 00001) + extension (which is always .jpg). For example,
-- curling-low.00001.jpg
frameCaptureGroupSettings_destination :: Lens.Lens' FrameCaptureGroupSettings OutputLocationRef
frameCaptureGroupSettings_destination :: Lens' FrameCaptureGroupSettings OutputLocationRef
frameCaptureGroupSettings_destination = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FrameCaptureGroupSettings' {OutputLocationRef
destination :: OutputLocationRef
$sel:destination:FrameCaptureGroupSettings' :: FrameCaptureGroupSettings -> OutputLocationRef
destination} -> OutputLocationRef
destination) (\s :: FrameCaptureGroupSettings
s@FrameCaptureGroupSettings' {} OutputLocationRef
a -> FrameCaptureGroupSettings
s {$sel:destination:FrameCaptureGroupSettings' :: OutputLocationRef
destination = OutputLocationRef
a} :: FrameCaptureGroupSettings)

instance Data.FromJSON FrameCaptureGroupSettings where
  parseJSON :: Value -> Parser FrameCaptureGroupSettings
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"FrameCaptureGroupSettings"
      ( \Object
x ->
          Maybe FrameCaptureCdnSettings
-> OutputLocationRef -> FrameCaptureGroupSettings
FrameCaptureGroupSettings'
            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
"frameCaptureCdnSettings")
            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
"destination")
      )

instance Prelude.Hashable FrameCaptureGroupSettings where
  hashWithSalt :: Int -> FrameCaptureGroupSettings -> Int
hashWithSalt Int
_salt FrameCaptureGroupSettings' {Maybe FrameCaptureCdnSettings
OutputLocationRef
destination :: OutputLocationRef
frameCaptureCdnSettings :: Maybe FrameCaptureCdnSettings
$sel:destination:FrameCaptureGroupSettings' :: FrameCaptureGroupSettings -> OutputLocationRef
$sel:frameCaptureCdnSettings:FrameCaptureGroupSettings' :: FrameCaptureGroupSettings -> Maybe FrameCaptureCdnSettings
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe FrameCaptureCdnSettings
frameCaptureCdnSettings
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` OutputLocationRef
destination

instance Prelude.NFData FrameCaptureGroupSettings where
  rnf :: FrameCaptureGroupSettings -> ()
rnf FrameCaptureGroupSettings' {Maybe FrameCaptureCdnSettings
OutputLocationRef
destination :: OutputLocationRef
frameCaptureCdnSettings :: Maybe FrameCaptureCdnSettings
$sel:destination:FrameCaptureGroupSettings' :: FrameCaptureGroupSettings -> OutputLocationRef
$sel:frameCaptureCdnSettings:FrameCaptureGroupSettings' :: FrameCaptureGroupSettings -> Maybe FrameCaptureCdnSettings
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe FrameCaptureCdnSettings
frameCaptureCdnSettings
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf OutputLocationRef
destination

instance Data.ToJSON FrameCaptureGroupSettings where
  toJSON :: FrameCaptureGroupSettings -> Value
toJSON FrameCaptureGroupSettings' {Maybe FrameCaptureCdnSettings
OutputLocationRef
destination :: OutputLocationRef
frameCaptureCdnSettings :: Maybe FrameCaptureCdnSettings
$sel:destination:FrameCaptureGroupSettings' :: FrameCaptureGroupSettings -> OutputLocationRef
$sel:frameCaptureCdnSettings:FrameCaptureGroupSettings' :: FrameCaptureGroupSettings -> Maybe FrameCaptureCdnSettings
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"frameCaptureCdnSettings" 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 FrameCaptureCdnSettings
frameCaptureCdnSettings,
            forall a. a -> Maybe a
Prelude.Just (Key
"destination" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= OutputLocationRef
destination)
          ]
      )