{-# 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.DialogCodeHookSettings
-- 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.DialogCodeHookSettings where

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

-- | Settings that determine the Lambda function that Amazon Lex uses for
-- processing user responses.
--
-- /See:/ 'newDialogCodeHookSettings' smart constructor.
data DialogCodeHookSettings = DialogCodeHookSettings'
  { -- | Enables the dialog code hook so that it processes user requests.
    DialogCodeHookSettings -> Bool
enabled :: Prelude.Bool
  }
  deriving (DialogCodeHookSettings -> DialogCodeHookSettings -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DialogCodeHookSettings -> DialogCodeHookSettings -> Bool
$c/= :: DialogCodeHookSettings -> DialogCodeHookSettings -> Bool
== :: DialogCodeHookSettings -> DialogCodeHookSettings -> Bool
$c== :: DialogCodeHookSettings -> DialogCodeHookSettings -> Bool
Prelude.Eq, ReadPrec [DialogCodeHookSettings]
ReadPrec DialogCodeHookSettings
Int -> ReadS DialogCodeHookSettings
ReadS [DialogCodeHookSettings]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DialogCodeHookSettings]
$creadListPrec :: ReadPrec [DialogCodeHookSettings]
readPrec :: ReadPrec DialogCodeHookSettings
$creadPrec :: ReadPrec DialogCodeHookSettings
readList :: ReadS [DialogCodeHookSettings]
$creadList :: ReadS [DialogCodeHookSettings]
readsPrec :: Int -> ReadS DialogCodeHookSettings
$creadsPrec :: Int -> ReadS DialogCodeHookSettings
Prelude.Read, Int -> DialogCodeHookSettings -> ShowS
[DialogCodeHookSettings] -> ShowS
DialogCodeHookSettings -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DialogCodeHookSettings] -> ShowS
$cshowList :: [DialogCodeHookSettings] -> ShowS
show :: DialogCodeHookSettings -> String
$cshow :: DialogCodeHookSettings -> String
showsPrec :: Int -> DialogCodeHookSettings -> ShowS
$cshowsPrec :: Int -> DialogCodeHookSettings -> ShowS
Prelude.Show, forall x. Rep DialogCodeHookSettings x -> DialogCodeHookSettings
forall x. DialogCodeHookSettings -> Rep DialogCodeHookSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DialogCodeHookSettings x -> DialogCodeHookSettings
$cfrom :: forall x. DialogCodeHookSettings -> Rep DialogCodeHookSettings x
Prelude.Generic)

-- |
-- Create a value of 'DialogCodeHookSettings' 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', 'dialogCodeHookSettings_enabled' - Enables the dialog code hook so that it processes user requests.
newDialogCodeHookSettings ::
  -- | 'enabled'
  Prelude.Bool ->
  DialogCodeHookSettings
newDialogCodeHookSettings :: Bool -> DialogCodeHookSettings
newDialogCodeHookSettings Bool
pEnabled_ =
  DialogCodeHookSettings' {$sel:enabled:DialogCodeHookSettings' :: Bool
enabled = Bool
pEnabled_}

-- | Enables the dialog code hook so that it processes user requests.
dialogCodeHookSettings_enabled :: Lens.Lens' DialogCodeHookSettings Prelude.Bool
dialogCodeHookSettings_enabled :: Lens' DialogCodeHookSettings Bool
dialogCodeHookSettings_enabled = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DialogCodeHookSettings' {Bool
enabled :: Bool
$sel:enabled:DialogCodeHookSettings' :: DialogCodeHookSettings -> Bool
enabled} -> Bool
enabled) (\s :: DialogCodeHookSettings
s@DialogCodeHookSettings' {} Bool
a -> DialogCodeHookSettings
s {$sel:enabled:DialogCodeHookSettings' :: Bool
enabled = Bool
a} :: DialogCodeHookSettings)

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

instance Prelude.Hashable DialogCodeHookSettings where
  hashWithSalt :: Int -> DialogCodeHookSettings -> Int
hashWithSalt Int
_salt DialogCodeHookSettings' {Bool
enabled :: Bool
$sel:enabled:DialogCodeHookSettings' :: DialogCodeHookSettings -> Bool
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Bool
enabled

instance Prelude.NFData DialogCodeHookSettings where
  rnf :: DialogCodeHookSettings -> ()
rnf DialogCodeHookSettings' {Bool
enabled :: Bool
$sel:enabled:DialogCodeHookSettings' :: DialogCodeHookSettings -> Bool
..} = forall a. NFData a => a -> ()
Prelude.rnf Bool
enabled

instance Data.ToJSON DialogCodeHookSettings where
  toJSON :: DialogCodeHookSettings -> Value
toJSON DialogCodeHookSettings' {Bool
enabled :: Bool
$sel:enabled:DialogCodeHookSettings' :: DialogCodeHookSettings -> 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)]
      )