{-# 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.MediaConvert.Types.DestinationSettings
-- 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.MediaConvert.Types.DestinationSettings where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MediaConvert.Types.S3DestinationSettings
import qualified Amazonka.Prelude as Prelude

-- | Settings associated with the destination. Will vary based on the type of
-- destination
--
-- /See:/ 'newDestinationSettings' smart constructor.
data DestinationSettings = DestinationSettings'
  { -- | Settings associated with S3 destination
    DestinationSettings -> Maybe S3DestinationSettings
s3Settings :: Prelude.Maybe S3DestinationSettings
  }
  deriving (DestinationSettings -> DestinationSettings -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DestinationSettings -> DestinationSettings -> Bool
$c/= :: DestinationSettings -> DestinationSettings -> Bool
== :: DestinationSettings -> DestinationSettings -> Bool
$c== :: DestinationSettings -> DestinationSettings -> Bool
Prelude.Eq, ReadPrec [DestinationSettings]
ReadPrec DestinationSettings
Int -> ReadS DestinationSettings
ReadS [DestinationSettings]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DestinationSettings]
$creadListPrec :: ReadPrec [DestinationSettings]
readPrec :: ReadPrec DestinationSettings
$creadPrec :: ReadPrec DestinationSettings
readList :: ReadS [DestinationSettings]
$creadList :: ReadS [DestinationSettings]
readsPrec :: Int -> ReadS DestinationSettings
$creadsPrec :: Int -> ReadS DestinationSettings
Prelude.Read, Int -> DestinationSettings -> ShowS
[DestinationSettings] -> ShowS
DestinationSettings -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DestinationSettings] -> ShowS
$cshowList :: [DestinationSettings] -> ShowS
show :: DestinationSettings -> String
$cshow :: DestinationSettings -> String
showsPrec :: Int -> DestinationSettings -> ShowS
$cshowsPrec :: Int -> DestinationSettings -> ShowS
Prelude.Show, forall x. Rep DestinationSettings x -> DestinationSettings
forall x. DestinationSettings -> Rep DestinationSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DestinationSettings x -> DestinationSettings
$cfrom :: forall x. DestinationSettings -> Rep DestinationSettings x
Prelude.Generic)

-- |
-- Create a value of 'DestinationSettings' 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:
--
-- 's3Settings', 'destinationSettings_s3Settings' - Settings associated with S3 destination
newDestinationSettings ::
  DestinationSettings
newDestinationSettings :: DestinationSettings
newDestinationSettings =
  DestinationSettings' {$sel:s3Settings:DestinationSettings' :: Maybe S3DestinationSettings
s3Settings = forall a. Maybe a
Prelude.Nothing}

-- | Settings associated with S3 destination
destinationSettings_s3Settings :: Lens.Lens' DestinationSettings (Prelude.Maybe S3DestinationSettings)
destinationSettings_s3Settings :: Lens' DestinationSettings (Maybe S3DestinationSettings)
destinationSettings_s3Settings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DestinationSettings' {Maybe S3DestinationSettings
s3Settings :: Maybe S3DestinationSettings
$sel:s3Settings:DestinationSettings' :: DestinationSettings -> Maybe S3DestinationSettings
s3Settings} -> Maybe S3DestinationSettings
s3Settings) (\s :: DestinationSettings
s@DestinationSettings' {} Maybe S3DestinationSettings
a -> DestinationSettings
s {$sel:s3Settings:DestinationSettings' :: Maybe S3DestinationSettings
s3Settings = Maybe S3DestinationSettings
a} :: DestinationSettings)

instance Data.FromJSON DestinationSettings where
  parseJSON :: Value -> Parser DestinationSettings
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"DestinationSettings"
      ( \Object
x ->
          Maybe S3DestinationSettings -> DestinationSettings
DestinationSettings'
            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
"s3Settings")
      )

instance Prelude.Hashable DestinationSettings where
  hashWithSalt :: Int -> DestinationSettings -> Int
hashWithSalt Int
_salt DestinationSettings' {Maybe S3DestinationSettings
s3Settings :: Maybe S3DestinationSettings
$sel:s3Settings:DestinationSettings' :: DestinationSettings -> Maybe S3DestinationSettings
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe S3DestinationSettings
s3Settings

instance Prelude.NFData DestinationSettings where
  rnf :: DestinationSettings -> ()
rnf DestinationSettings' {Maybe S3DestinationSettings
s3Settings :: Maybe S3DestinationSettings
$sel:s3Settings:DestinationSettings' :: DestinationSettings -> Maybe S3DestinationSettings
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe S3DestinationSettings
s3Settings

instance Data.ToJSON DestinationSettings where
  toJSON :: DestinationSettings -> Value
toJSON DestinationSettings' {Maybe S3DestinationSettings
s3Settings :: Maybe S3DestinationSettings
$sel:s3Settings:DestinationSettings' :: DestinationSettings -> Maybe S3DestinationSettings
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Key
"s3Settings" 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 S3DestinationSettings
s3Settings]
      )