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

-- | Contains information about code hooks that Amazon Lex calls during a
-- conversation.
--
-- /See:/ 'newCodeHookSpecification' smart constructor.
data CodeHookSpecification = CodeHookSpecification'
  { CodeHookSpecification -> LambdaCodeHook
lambdaCodeHook :: LambdaCodeHook
  }
  deriving (CodeHookSpecification -> CodeHookSpecification -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CodeHookSpecification -> CodeHookSpecification -> Bool
$c/= :: CodeHookSpecification -> CodeHookSpecification -> Bool
== :: CodeHookSpecification -> CodeHookSpecification -> Bool
$c== :: CodeHookSpecification -> CodeHookSpecification -> Bool
Prelude.Eq, ReadPrec [CodeHookSpecification]
ReadPrec CodeHookSpecification
Int -> ReadS CodeHookSpecification
ReadS [CodeHookSpecification]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CodeHookSpecification]
$creadListPrec :: ReadPrec [CodeHookSpecification]
readPrec :: ReadPrec CodeHookSpecification
$creadPrec :: ReadPrec CodeHookSpecification
readList :: ReadS [CodeHookSpecification]
$creadList :: ReadS [CodeHookSpecification]
readsPrec :: Int -> ReadS CodeHookSpecification
$creadsPrec :: Int -> ReadS CodeHookSpecification
Prelude.Read, Int -> CodeHookSpecification -> ShowS
[CodeHookSpecification] -> ShowS
CodeHookSpecification -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CodeHookSpecification] -> ShowS
$cshowList :: [CodeHookSpecification] -> ShowS
show :: CodeHookSpecification -> String
$cshow :: CodeHookSpecification -> String
showsPrec :: Int -> CodeHookSpecification -> ShowS
$cshowsPrec :: Int -> CodeHookSpecification -> ShowS
Prelude.Show, forall x. Rep CodeHookSpecification x -> CodeHookSpecification
forall x. CodeHookSpecification -> Rep CodeHookSpecification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CodeHookSpecification x -> CodeHookSpecification
$cfrom :: forall x. CodeHookSpecification -> Rep CodeHookSpecification x
Prelude.Generic)

-- |
-- Create a value of 'CodeHookSpecification' 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:
--
-- 'lambdaCodeHook', 'codeHookSpecification_lambdaCodeHook' - Undocumented member.
newCodeHookSpecification ::
  -- | 'lambdaCodeHook'
  LambdaCodeHook ->
  CodeHookSpecification
newCodeHookSpecification :: LambdaCodeHook -> CodeHookSpecification
newCodeHookSpecification LambdaCodeHook
pLambdaCodeHook_ =
  CodeHookSpecification'
    { $sel:lambdaCodeHook:CodeHookSpecification' :: LambdaCodeHook
lambdaCodeHook =
        LambdaCodeHook
pLambdaCodeHook_
    }

-- | Undocumented member.
codeHookSpecification_lambdaCodeHook :: Lens.Lens' CodeHookSpecification LambdaCodeHook
codeHookSpecification_lambdaCodeHook :: Lens' CodeHookSpecification LambdaCodeHook
codeHookSpecification_lambdaCodeHook = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CodeHookSpecification' {LambdaCodeHook
lambdaCodeHook :: LambdaCodeHook
$sel:lambdaCodeHook:CodeHookSpecification' :: CodeHookSpecification -> LambdaCodeHook
lambdaCodeHook} -> LambdaCodeHook
lambdaCodeHook) (\s :: CodeHookSpecification
s@CodeHookSpecification' {} LambdaCodeHook
a -> CodeHookSpecification
s {$sel:lambdaCodeHook:CodeHookSpecification' :: LambdaCodeHook
lambdaCodeHook = LambdaCodeHook
a} :: CodeHookSpecification)

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

instance Prelude.Hashable CodeHookSpecification where
  hashWithSalt :: Int -> CodeHookSpecification -> Int
hashWithSalt Int
_salt CodeHookSpecification' {LambdaCodeHook
lambdaCodeHook :: LambdaCodeHook
$sel:lambdaCodeHook:CodeHookSpecification' :: CodeHookSpecification -> LambdaCodeHook
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` LambdaCodeHook
lambdaCodeHook

instance Prelude.NFData CodeHookSpecification where
  rnf :: CodeHookSpecification -> ()
rnf CodeHookSpecification' {LambdaCodeHook
lambdaCodeHook :: LambdaCodeHook
$sel:lambdaCodeHook:CodeHookSpecification' :: CodeHookSpecification -> LambdaCodeHook
..} =
    forall a. NFData a => a -> ()
Prelude.rnf LambdaCodeHook
lambdaCodeHook

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