{-# 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.LexV2Models.Types.AudioLogSetting
-- 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.LexV2Models.Types.AudioLogSetting where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.LexV2Models.Types.AudioLogDestination
import qualified Amazonka.Prelude as Prelude

-- | Settings for logging audio of conversations between Amazon Lex and a
-- user. You specify whether to log audio and the Amazon S3 bucket where
-- the audio file is stored.
--
-- /See:/ 'newAudioLogSetting' smart constructor.
data AudioLogSetting = AudioLogSetting'
  { -- | Determines whether audio logging in enabled for the bot.
    AudioLogSetting -> Bool
enabled :: Prelude.Bool,
    AudioLogSetting -> AudioLogDestination
destination :: AudioLogDestination
  }
  deriving (AudioLogSetting -> AudioLogSetting -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AudioLogSetting -> AudioLogSetting -> Bool
$c/= :: AudioLogSetting -> AudioLogSetting -> Bool
== :: AudioLogSetting -> AudioLogSetting -> Bool
$c== :: AudioLogSetting -> AudioLogSetting -> Bool
Prelude.Eq, ReadPrec [AudioLogSetting]
ReadPrec AudioLogSetting
Int -> ReadS AudioLogSetting
ReadS [AudioLogSetting]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AudioLogSetting]
$creadListPrec :: ReadPrec [AudioLogSetting]
readPrec :: ReadPrec AudioLogSetting
$creadPrec :: ReadPrec AudioLogSetting
readList :: ReadS [AudioLogSetting]
$creadList :: ReadS [AudioLogSetting]
readsPrec :: Int -> ReadS AudioLogSetting
$creadsPrec :: Int -> ReadS AudioLogSetting
Prelude.Read, Int -> AudioLogSetting -> ShowS
[AudioLogSetting] -> ShowS
AudioLogSetting -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AudioLogSetting] -> ShowS
$cshowList :: [AudioLogSetting] -> ShowS
show :: AudioLogSetting -> String
$cshow :: AudioLogSetting -> String
showsPrec :: Int -> AudioLogSetting -> ShowS
$cshowsPrec :: Int -> AudioLogSetting -> ShowS
Prelude.Show, forall x. Rep AudioLogSetting x -> AudioLogSetting
forall x. AudioLogSetting -> Rep AudioLogSetting x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AudioLogSetting x -> AudioLogSetting
$cfrom :: forall x. AudioLogSetting -> Rep AudioLogSetting x
Prelude.Generic)

-- |
-- Create a value of 'AudioLogSetting' 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:
--
-- 'enabled', 'audioLogSetting_enabled' - Determines whether audio logging in enabled for the bot.
--
-- 'destination', 'audioLogSetting_destination' - Undocumented member.
newAudioLogSetting ::
  -- | 'enabled'
  Prelude.Bool ->
  -- | 'destination'
  AudioLogDestination ->
  AudioLogSetting
newAudioLogSetting :: Bool -> AudioLogDestination -> AudioLogSetting
newAudioLogSetting Bool
pEnabled_ AudioLogDestination
pDestination_ =
  AudioLogSetting'
    { $sel:enabled:AudioLogSetting' :: Bool
enabled = Bool
pEnabled_,
      $sel:destination:AudioLogSetting' :: AudioLogDestination
destination = AudioLogDestination
pDestination_
    }

-- | Determines whether audio logging in enabled for the bot.
audioLogSetting_enabled :: Lens.Lens' AudioLogSetting Prelude.Bool
audioLogSetting_enabled :: Lens' AudioLogSetting Bool
audioLogSetting_enabled = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AudioLogSetting' {Bool
enabled :: Bool
$sel:enabled:AudioLogSetting' :: AudioLogSetting -> Bool
enabled} -> Bool
enabled) (\s :: AudioLogSetting
s@AudioLogSetting' {} Bool
a -> AudioLogSetting
s {$sel:enabled:AudioLogSetting' :: Bool
enabled = Bool
a} :: AudioLogSetting)

-- | Undocumented member.
audioLogSetting_destination :: Lens.Lens' AudioLogSetting AudioLogDestination
audioLogSetting_destination :: Lens' AudioLogSetting AudioLogDestination
audioLogSetting_destination = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AudioLogSetting' {AudioLogDestination
destination :: AudioLogDestination
$sel:destination:AudioLogSetting' :: AudioLogSetting -> AudioLogDestination
destination} -> AudioLogDestination
destination) (\s :: AudioLogSetting
s@AudioLogSetting' {} AudioLogDestination
a -> AudioLogSetting
s {$sel:destination:AudioLogSetting' :: AudioLogDestination
destination = AudioLogDestination
a} :: AudioLogSetting)

instance Data.FromJSON AudioLogSetting where
  parseJSON :: Value -> Parser AudioLogSetting
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AudioLogSetting"
      ( \Object
x ->
          Bool -> AudioLogDestination -> AudioLogSetting
AudioLogSetting'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"enabled")
            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 AudioLogSetting where
  hashWithSalt :: Int -> AudioLogSetting -> Int
hashWithSalt Int
_salt AudioLogSetting' {Bool
AudioLogDestination
destination :: AudioLogDestination
enabled :: Bool
$sel:destination:AudioLogSetting' :: AudioLogSetting -> AudioLogDestination
$sel:enabled:AudioLogSetting' :: AudioLogSetting -> Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Bool
enabled
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` AudioLogDestination
destination

instance Prelude.NFData AudioLogSetting where
  rnf :: AudioLogSetting -> ()
rnf AudioLogSetting' {Bool
AudioLogDestination
destination :: AudioLogDestination
enabled :: Bool
$sel:destination:AudioLogSetting' :: AudioLogSetting -> AudioLogDestination
$sel:enabled:AudioLogSetting' :: AudioLogSetting -> Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Bool
enabled
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf AudioLogDestination
destination

instance Data.ToJSON AudioLogSetting where
  toJSON :: AudioLogSetting -> Value
toJSON AudioLogSetting' {Bool
AudioLogDestination
destination :: AudioLogDestination
enabled :: Bool
$sel:destination:AudioLogSetting' :: AudioLogSetting -> AudioLogDestination
$sel:enabled:AudioLogSetting' :: AudioLogSetting -> Bool
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just (Key
"enabled" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Bool
enabled),
            forall a. a -> Maybe a
Prelude.Just (Key
"destination" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= AudioLogDestination
destination)
          ]
      )