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

import Amazonka.Chime.Types.ArtifactsState
import Amazonka.Chime.Types.ContentMuxType
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(ContentArtifactsConfiguration
 -> ContentArtifactsConfiguration -> Bool)
-> (ContentArtifactsConfiguration
    -> ContentArtifactsConfiguration -> Bool)
-> Eq ContentArtifactsConfiguration
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]
(Int -> ReadS ContentArtifactsConfiguration)
-> ReadS [ContentArtifactsConfiguration]
-> ReadPrec ContentArtifactsConfiguration
-> ReadPrec [ContentArtifactsConfiguration]
-> Read 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
(Int -> ContentArtifactsConfiguration -> ShowS)
-> (ContentArtifactsConfiguration -> String)
-> ([ContentArtifactsConfiguration] -> ShowS)
-> Show ContentArtifactsConfiguration
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.
 ContentArtifactsConfiguration
 -> Rep ContentArtifactsConfiguration x)
-> (forall x.
    Rep ContentArtifactsConfiguration x
    -> ContentArtifactsConfiguration)
-> Generic ContentArtifactsConfiguration
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' :: Maybe ContentMuxType
-> ArtifactsState -> ContentArtifactsConfiguration
ContentArtifactsConfiguration'
    { $sel:muxType:ContentArtifactsConfiguration' :: Maybe ContentMuxType
muxType =
        Maybe ContentMuxType
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 :: (Maybe ContentMuxType -> f (Maybe ContentMuxType))
-> ContentArtifactsConfiguration -> f ContentArtifactsConfiguration
contentArtifactsConfiguration_muxType = (ContentArtifactsConfiguration -> Maybe ContentMuxType)
-> (ContentArtifactsConfiguration
    -> Maybe ContentMuxType -> ContentArtifactsConfiguration)
-> Lens
     ContentArtifactsConfiguration
     ContentArtifactsConfiguration
     (Maybe ContentMuxType)
     (Maybe ContentMuxType)
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 :: (ArtifactsState -> f ArtifactsState)
-> ContentArtifactsConfiguration -> f ContentArtifactsConfiguration
contentArtifactsConfiguration_state = (ContentArtifactsConfiguration -> ArtifactsState)
-> (ContentArtifactsConfiguration
    -> ArtifactsState -> ContentArtifactsConfiguration)
-> Lens
     ContentArtifactsConfiguration
     ContentArtifactsConfiguration
     ArtifactsState
     ArtifactsState
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 Core.FromJSON ContentArtifactsConfiguration where
  parseJSON :: Value -> Parser ContentArtifactsConfiguration
parseJSON =
    String
-> (Object -> Parser ContentArtifactsConfiguration)
-> Value
-> Parser ContentArtifactsConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ContentArtifactsConfiguration"
      ( \Object
x ->
          Maybe ContentMuxType
-> ArtifactsState -> ContentArtifactsConfiguration
ContentArtifactsConfiguration'
            (Maybe ContentMuxType
 -> ArtifactsState -> ContentArtifactsConfiguration)
-> Parser (Maybe ContentMuxType)
-> Parser (ArtifactsState -> ContentArtifactsConfiguration)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ContentMuxType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"MuxType")
            Parser (ArtifactsState -> ContentArtifactsConfiguration)
-> Parser ArtifactsState -> Parser ContentArtifactsConfiguration
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser ArtifactsState
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"State")
      )

instance
  Prelude.Hashable
    ContentArtifactsConfiguration

instance Prelude.NFData ContentArtifactsConfiguration

instance Core.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
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"MuxType" Text -> ContentMuxType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ContentMuxType -> Pair) -> Maybe ContentMuxType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ContentMuxType
muxType,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"State" Text -> ArtifactsState -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ArtifactsState
state)
          ]
      )