{-# 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.UdpContainerSettings
-- 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.UdpContainerSettings 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.M2tsSettings
import qualified Amazonka.Prelude as Prelude

-- | Udp Container Settings
--
-- /See:/ 'newUdpContainerSettings' smart constructor.
data UdpContainerSettings = UdpContainerSettings'
  { UdpContainerSettings -> Maybe M2tsSettings
m2tsSettings :: Prelude.Maybe M2tsSettings
  }
  deriving (UdpContainerSettings -> UdpContainerSettings -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UdpContainerSettings -> UdpContainerSettings -> Bool
$c/= :: UdpContainerSettings -> UdpContainerSettings -> Bool
== :: UdpContainerSettings -> UdpContainerSettings -> Bool
$c== :: UdpContainerSettings -> UdpContainerSettings -> Bool
Prelude.Eq, ReadPrec [UdpContainerSettings]
ReadPrec UdpContainerSettings
Int -> ReadS UdpContainerSettings
ReadS [UdpContainerSettings]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UdpContainerSettings]
$creadListPrec :: ReadPrec [UdpContainerSettings]
readPrec :: ReadPrec UdpContainerSettings
$creadPrec :: ReadPrec UdpContainerSettings
readList :: ReadS [UdpContainerSettings]
$creadList :: ReadS [UdpContainerSettings]
readsPrec :: Int -> ReadS UdpContainerSettings
$creadsPrec :: Int -> ReadS UdpContainerSettings
Prelude.Read, Int -> UdpContainerSettings -> ShowS
[UdpContainerSettings] -> ShowS
UdpContainerSettings -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UdpContainerSettings] -> ShowS
$cshowList :: [UdpContainerSettings] -> ShowS
show :: UdpContainerSettings -> String
$cshow :: UdpContainerSettings -> String
showsPrec :: Int -> UdpContainerSettings -> ShowS
$cshowsPrec :: Int -> UdpContainerSettings -> ShowS
Prelude.Show, forall x. Rep UdpContainerSettings x -> UdpContainerSettings
forall x. UdpContainerSettings -> Rep UdpContainerSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UdpContainerSettings x -> UdpContainerSettings
$cfrom :: forall x. UdpContainerSettings -> Rep UdpContainerSettings x
Prelude.Generic)

-- |
-- Create a value of 'UdpContainerSettings' 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:
--
-- 'm2tsSettings', 'udpContainerSettings_m2tsSettings' - Undocumented member.
newUdpContainerSettings ::
  UdpContainerSettings
newUdpContainerSettings :: UdpContainerSettings
newUdpContainerSettings =
  UdpContainerSettings'
    { $sel:m2tsSettings:UdpContainerSettings' :: Maybe M2tsSettings
m2tsSettings =
        forall a. Maybe a
Prelude.Nothing
    }

-- | Undocumented member.
udpContainerSettings_m2tsSettings :: Lens.Lens' UdpContainerSettings (Prelude.Maybe M2tsSettings)
udpContainerSettings_m2tsSettings :: Lens' UdpContainerSettings (Maybe M2tsSettings)
udpContainerSettings_m2tsSettings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UdpContainerSettings' {Maybe M2tsSettings
m2tsSettings :: Maybe M2tsSettings
$sel:m2tsSettings:UdpContainerSettings' :: UdpContainerSettings -> Maybe M2tsSettings
m2tsSettings} -> Maybe M2tsSettings
m2tsSettings) (\s :: UdpContainerSettings
s@UdpContainerSettings' {} Maybe M2tsSettings
a -> UdpContainerSettings
s {$sel:m2tsSettings:UdpContainerSettings' :: Maybe M2tsSettings
m2tsSettings = Maybe M2tsSettings
a} :: UdpContainerSettings)

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

instance Prelude.Hashable UdpContainerSettings where
  hashWithSalt :: Int -> UdpContainerSettings -> Int
hashWithSalt Int
_salt UdpContainerSettings' {Maybe M2tsSettings
m2tsSettings :: Maybe M2tsSettings
$sel:m2tsSettings:UdpContainerSettings' :: UdpContainerSettings -> Maybe M2tsSettings
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe M2tsSettings
m2tsSettings

instance Prelude.NFData UdpContainerSettings where
  rnf :: UdpContainerSettings -> ()
rnf UdpContainerSettings' {Maybe M2tsSettings
m2tsSettings :: Maybe M2tsSettings
$sel:m2tsSettings:UdpContainerSettings' :: UdpContainerSettings -> Maybe M2tsSettings
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe M2tsSettings
m2tsSettings

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