{-# 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.Chime.Types.ContentArtifactsConfiguration
-- 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.Chime.Types.ContentArtifactsConfiguration where

import Amazonka.Chime.Types.ArtifactsState
import Amazonka.Chime.Types.ContentMuxType
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | The content artifact object.
--
-- /See:/ 'newContentArtifactsConfiguration' smart constructor.
data ContentArtifactsConfiguration = ContentArtifactsConfiguration'
  { -- | The MUX type of the artifact configuration.
    ContentArtifactsConfiguration -> Maybe ContentMuxType
muxType :: Prelude.Maybe ContentMuxType,
    -- | Indicates whether the content artifact is enabled or disabled.
    ContentArtifactsConfiguration -> ArtifactsState
state :: ArtifactsState
  }
  deriving (ContentArtifactsConfiguration
-> ContentArtifactsConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ContentArtifactsConfiguration
-> ContentArtifactsConfiguration -> Bool
$c/= :: ContentArtifactsConfiguration
-> ContentArtifactsConfiguration -> Bool
== :: ContentArtifactsConfiguration
-> ContentArtifactsConfiguration -> Bool
$c== :: ContentArtifactsConfiguration
-> ContentArtifactsConfiguration -> Bool
Prelude.Eq, ReadPrec [ContentArtifactsConfiguration]
ReadPrec ContentArtifactsConfiguration
Int -> ReadS ContentArtifactsConfiguration
ReadS [ContentArtifactsConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ContentArtifactsConfiguration]
$creadListPrec :: ReadPrec [ContentArtifactsConfiguration]
readPrec :: ReadPrec ContentArtifactsConfiguration
$creadPrec :: ReadPrec ContentArtifactsConfiguration
readList :: ReadS [ContentArtifactsConfiguration]
$creadList :: ReadS [ContentArtifactsConfiguration]
readsPrec :: Int -> ReadS ContentArtifactsConfiguration
$creadsPrec :: Int -> ReadS ContentArtifactsConfiguration
Prelude.Read, Int -> ContentArtifactsConfiguration -> ShowS
[ContentArtifactsConfiguration] -> ShowS
ContentArtifactsConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ContentArtifactsConfiguration] -> ShowS
$cshowList :: [ContentArtifactsConfiguration] -> ShowS
show :: ContentArtifactsConfiguration -> String
$cshow :: ContentArtifactsConfiguration -> String
showsPrec :: Int -> ContentArtifactsConfiguration -> ShowS
$cshowsPrec :: Int -> ContentArtifactsConfiguration -> ShowS
Prelude.Show, forall x.
Rep ContentArtifactsConfiguration x
-> ContentArtifactsConfiguration
forall x.
ContentArtifactsConfiguration
-> Rep ContentArtifactsConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ContentArtifactsConfiguration x
-> ContentArtifactsConfiguration
$cfrom :: forall x.
ContentArtifactsConfiguration
-> Rep ContentArtifactsConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'ContentArtifactsConfiguration' 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:
--
-- 'muxType', 'contentArtifactsConfiguration_muxType' - The MUX type of the artifact configuration.
--
-- 'state', 'contentArtifactsConfiguration_state' - Indicates whether the content artifact is enabled or disabled.
newContentArtifactsConfiguration ::
  -- | 'state'
  ArtifactsState ->
  ContentArtifactsConfiguration
newContentArtifactsConfiguration :: ArtifactsState -> ContentArtifactsConfiguration
newContentArtifactsConfiguration ArtifactsState
pState_ =
  ContentArtifactsConfiguration'
    { $sel:muxType:ContentArtifactsConfiguration' :: Maybe ContentMuxType
muxType =
        forall a. Maybe a
Prelude.Nothing,
      $sel:state:ContentArtifactsConfiguration' :: ArtifactsState
state = ArtifactsState
pState_
    }

-- | The MUX type of the artifact configuration.
contentArtifactsConfiguration_muxType :: Lens.Lens' ContentArtifactsConfiguration (Prelude.Maybe ContentMuxType)
contentArtifactsConfiguration_muxType :: Lens' ContentArtifactsConfiguration (Maybe ContentMuxType)
contentArtifactsConfiguration_muxType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContentArtifactsConfiguration' {Maybe ContentMuxType
muxType :: Maybe ContentMuxType
$sel:muxType:ContentArtifactsConfiguration' :: ContentArtifactsConfiguration -> Maybe ContentMuxType
muxType} -> Maybe ContentMuxType
muxType) (\s :: ContentArtifactsConfiguration
s@ContentArtifactsConfiguration' {} Maybe ContentMuxType
a -> ContentArtifactsConfiguration
s {$sel:muxType:ContentArtifactsConfiguration' :: Maybe ContentMuxType
muxType = Maybe ContentMuxType
a} :: ContentArtifactsConfiguration)

-- | Indicates whether the content artifact is enabled or disabled.
contentArtifactsConfiguration_state :: Lens.Lens' ContentArtifactsConfiguration ArtifactsState
contentArtifactsConfiguration_state :: Lens' ContentArtifactsConfiguration ArtifactsState
contentArtifactsConfiguration_state = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContentArtifactsConfiguration' {ArtifactsState
state :: ArtifactsState
$sel:state:ContentArtifactsConfiguration' :: ContentArtifactsConfiguration -> ArtifactsState
state} -> ArtifactsState
state) (\s :: ContentArtifactsConfiguration
s@ContentArtifactsConfiguration' {} ArtifactsState
a -> ContentArtifactsConfiguration
s {$sel:state:ContentArtifactsConfiguration' :: ArtifactsState
state = ArtifactsState
a} :: ContentArtifactsConfiguration)

instance Data.FromJSON ContentArtifactsConfiguration where
  parseJSON :: Value -> Parser ContentArtifactsConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ContentArtifactsConfiguration"
      ( \Object
x ->
          Maybe ContentMuxType
-> ArtifactsState -> ContentArtifactsConfiguration
ContentArtifactsConfiguration'
            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
"MuxType")
            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
"State")
      )

instance
  Prelude.Hashable
    ContentArtifactsConfiguration
  where
  hashWithSalt :: Int -> ContentArtifactsConfiguration -> Int
hashWithSalt Int
_salt ContentArtifactsConfiguration' {Maybe ContentMuxType
ArtifactsState
state :: ArtifactsState
muxType :: Maybe ContentMuxType
$sel:state:ContentArtifactsConfiguration' :: ContentArtifactsConfiguration -> ArtifactsState
$sel:muxType:ContentArtifactsConfiguration' :: ContentArtifactsConfiguration -> Maybe ContentMuxType
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ContentMuxType
muxType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ArtifactsState
state

instance Prelude.NFData ContentArtifactsConfiguration where
  rnf :: ContentArtifactsConfiguration -> ()
rnf ContentArtifactsConfiguration' {Maybe ContentMuxType
ArtifactsState
state :: ArtifactsState
muxType :: Maybe ContentMuxType
$sel:state:ContentArtifactsConfiguration' :: ContentArtifactsConfiguration -> ArtifactsState
$sel:muxType:ContentArtifactsConfiguration' :: ContentArtifactsConfiguration -> Maybe ContentMuxType
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ContentMuxType
muxType seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ArtifactsState
state

instance Data.ToJSON ContentArtifactsConfiguration where
  toJSON :: ContentArtifactsConfiguration -> Value
toJSON ContentArtifactsConfiguration' {Maybe ContentMuxType
ArtifactsState
state :: ArtifactsState
muxType :: Maybe ContentMuxType
$sel:state:ContentArtifactsConfiguration' :: ContentArtifactsConfiguration -> ArtifactsState
$sel:muxType:ContentArtifactsConfiguration' :: ContentArtifactsConfiguration -> Maybe ContentMuxType
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"MuxType" 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 ContentMuxType
muxType,
            forall a. a -> Maybe a
Prelude.Just (Key
"State" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ArtifactsState
state)
          ]
      )