{-# 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.LexModels.Types.Slot
-- 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.LexModels.Types.Slot where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.LexModels.Types.ObfuscationSetting
import Amazonka.LexModels.Types.Prompt
import Amazonka.LexModels.Types.SlotConstraint
import Amazonka.LexModels.Types.SlotDefaultValueSpec
import qualified Amazonka.Prelude as Prelude

-- | Identifies the version of a specific slot.
--
-- /See:/ 'newSlot' smart constructor.
data Slot = Slot'
  { -- | The type of the slot, either a custom slot type that you defined or one
    -- of the built-in slot types.
    Slot -> Maybe Text
slotType :: Prelude.Maybe Prelude.Text,
    -- | The prompt that Amazon Lex uses to elicit the slot value from the user.
    Slot -> Maybe Prompt
valueElicitationPrompt :: Prelude.Maybe Prompt,
    -- | A set of possible responses for the slot type used by text-based
    -- clients. A user chooses an option from the response card, instead of
    -- using text to reply.
    Slot -> Maybe Text
responseCard :: Prelude.Maybe Prelude.Text,
    -- | Directs Amazon Lex the order in which to elicit this slot value from the
    -- user. For example, if the intent has two slots with priorities 1 and 2,
    -- AWS Amazon Lex first elicits a value for the slot with priority 1.
    --
    -- If multiple slots share the same priority, the order in which Amazon Lex
    -- elicits values is arbitrary.
    Slot -> Maybe Natural
priority :: Prelude.Maybe Prelude.Natural,
    -- | Determines whether a slot is obfuscated in conversation logs and stored
    -- utterances. When you obfuscate a slot, the value is replaced by the slot
    -- name in curly braces ({}). For example, if the slot name is
    -- \"full_name\", obfuscated values are replaced with \"{full_name}\". For
    -- more information, see
    -- <https://docs.aws.amazon.com/lex/latest/dg/how-obfuscate.html Slot Obfuscation>
    -- .
    Slot -> Maybe ObfuscationSetting
obfuscationSetting :: Prelude.Maybe ObfuscationSetting,
    -- | A list of default values for the slot. Default values are used when
    -- Amazon Lex hasn\'t determined a value for a slot. You can specify
    -- default values from context variables, session attributes, and defined
    -- values.
    Slot -> Maybe SlotDefaultValueSpec
defaultValueSpec :: Prelude.Maybe SlotDefaultValueSpec,
    -- | The version of the slot type.
    Slot -> Maybe Text
slotTypeVersion :: Prelude.Maybe Prelude.Text,
    -- | If you know a specific pattern with which users might respond to an
    -- Amazon Lex request for a slot value, you can provide those utterances to
    -- improve accuracy. This is optional. In most cases, Amazon Lex is capable
    -- of understanding user utterances.
    Slot -> Maybe [Text]
sampleUtterances :: Prelude.Maybe [Prelude.Text],
    -- | A description of the slot.
    Slot -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The name of the slot.
    Slot -> Text
name :: Prelude.Text,
    -- | Specifies whether the slot is required or optional.
    Slot -> SlotConstraint
slotConstraint :: SlotConstraint
  }
  deriving (Slot -> Slot -> Bool
(Slot -> Slot -> Bool) -> (Slot -> Slot -> Bool) -> Eq Slot
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Slot -> Slot -> Bool
$c/= :: Slot -> Slot -> Bool
== :: Slot -> Slot -> Bool
$c== :: Slot -> Slot -> Bool
Prelude.Eq, ReadPrec [Slot]
ReadPrec Slot
Int -> ReadS Slot
ReadS [Slot]
(Int -> ReadS Slot)
-> ReadS [Slot] -> ReadPrec Slot -> ReadPrec [Slot] -> Read Slot
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Slot]
$creadListPrec :: ReadPrec [Slot]
readPrec :: ReadPrec Slot
$creadPrec :: ReadPrec Slot
readList :: ReadS [Slot]
$creadList :: ReadS [Slot]
readsPrec :: Int -> ReadS Slot
$creadsPrec :: Int -> ReadS Slot
Prelude.Read, Int -> Slot -> ShowS
[Slot] -> ShowS
Slot -> String
(Int -> Slot -> ShowS)
-> (Slot -> String) -> ([Slot] -> ShowS) -> Show Slot
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Slot] -> ShowS
$cshowList :: [Slot] -> ShowS
show :: Slot -> String
$cshow :: Slot -> String
showsPrec :: Int -> Slot -> ShowS
$cshowsPrec :: Int -> Slot -> ShowS
Prelude.Show, (forall x. Slot -> Rep Slot x)
-> (forall x. Rep Slot x -> Slot) -> Generic Slot
forall x. Rep Slot x -> Slot
forall x. Slot -> Rep Slot x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Slot x -> Slot
$cfrom :: forall x. Slot -> Rep Slot x
Prelude.Generic)

-- |
-- Create a value of 'Slot' 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:
--
-- 'slotType', 'slot_slotType' - The type of the slot, either a custom slot type that you defined or one
-- of the built-in slot types.
--
-- 'valueElicitationPrompt', 'slot_valueElicitationPrompt' - The prompt that Amazon Lex uses to elicit the slot value from the user.
--
-- 'responseCard', 'slot_responseCard' - A set of possible responses for the slot type used by text-based
-- clients. A user chooses an option from the response card, instead of
-- using text to reply.
--
-- 'priority', 'slot_priority' - Directs Amazon Lex the order in which to elicit this slot value from the
-- user. For example, if the intent has two slots with priorities 1 and 2,
-- AWS Amazon Lex first elicits a value for the slot with priority 1.
--
-- If multiple slots share the same priority, the order in which Amazon Lex
-- elicits values is arbitrary.
--
-- 'obfuscationSetting', 'slot_obfuscationSetting' - Determines whether a slot is obfuscated in conversation logs and stored
-- utterances. When you obfuscate a slot, the value is replaced by the slot
-- name in curly braces ({}). For example, if the slot name is
-- \"full_name\", obfuscated values are replaced with \"{full_name}\". For
-- more information, see
-- <https://docs.aws.amazon.com/lex/latest/dg/how-obfuscate.html Slot Obfuscation>
-- .
--
-- 'defaultValueSpec', 'slot_defaultValueSpec' - A list of default values for the slot. Default values are used when
-- Amazon Lex hasn\'t determined a value for a slot. You can specify
-- default values from context variables, session attributes, and defined
-- values.
--
-- 'slotTypeVersion', 'slot_slotTypeVersion' - The version of the slot type.
--
-- 'sampleUtterances', 'slot_sampleUtterances' - If you know a specific pattern with which users might respond to an
-- Amazon Lex request for a slot value, you can provide those utterances to
-- improve accuracy. This is optional. In most cases, Amazon Lex is capable
-- of understanding user utterances.
--
-- 'description', 'slot_description' - A description of the slot.
--
-- 'name', 'slot_name' - The name of the slot.
--
-- 'slotConstraint', 'slot_slotConstraint' - Specifies whether the slot is required or optional.
newSlot ::
  -- | 'name'
  Prelude.Text ->
  -- | 'slotConstraint'
  SlotConstraint ->
  Slot
newSlot :: Text -> SlotConstraint -> Slot
newSlot Text
pName_ SlotConstraint
pSlotConstraint_ =
  Slot' :: Maybe Text
-> Maybe Prompt
-> Maybe Text
-> Maybe Natural
-> Maybe ObfuscationSetting
-> Maybe SlotDefaultValueSpec
-> Maybe Text
-> Maybe [Text]
-> Maybe Text
-> Text
-> SlotConstraint
-> Slot
Slot'
    { $sel:slotType:Slot' :: Maybe Text
slotType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:valueElicitationPrompt:Slot' :: Maybe Prompt
valueElicitationPrompt = Maybe Prompt
forall a. Maybe a
Prelude.Nothing,
      $sel:responseCard:Slot' :: Maybe Text
responseCard = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:priority:Slot' :: Maybe Natural
priority = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:obfuscationSetting:Slot' :: Maybe ObfuscationSetting
obfuscationSetting = Maybe ObfuscationSetting
forall a. Maybe a
Prelude.Nothing,
      $sel:defaultValueSpec:Slot' :: Maybe SlotDefaultValueSpec
defaultValueSpec = Maybe SlotDefaultValueSpec
forall a. Maybe a
Prelude.Nothing,
      $sel:slotTypeVersion:Slot' :: Maybe Text
slotTypeVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:sampleUtterances:Slot' :: Maybe [Text]
sampleUtterances = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:description:Slot' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:Slot' :: Text
name = Text
pName_,
      $sel:slotConstraint:Slot' :: SlotConstraint
slotConstraint = SlotConstraint
pSlotConstraint_
    }

-- | The type of the slot, either a custom slot type that you defined or one
-- of the built-in slot types.
slot_slotType :: Lens.Lens' Slot (Prelude.Maybe Prelude.Text)
slot_slotType :: (Maybe Text -> f (Maybe Text)) -> Slot -> f Slot
slot_slotType = (Slot -> Maybe Text)
-> (Slot -> Maybe Text -> Slot)
-> Lens Slot Slot (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Slot' {Maybe Text
slotType :: Maybe Text
$sel:slotType:Slot' :: Slot -> Maybe Text
slotType} -> Maybe Text
slotType) (\s :: Slot
s@Slot' {} Maybe Text
a -> Slot
s {$sel:slotType:Slot' :: Maybe Text
slotType = Maybe Text
a} :: Slot)

-- | The prompt that Amazon Lex uses to elicit the slot value from the user.
slot_valueElicitationPrompt :: Lens.Lens' Slot (Prelude.Maybe Prompt)
slot_valueElicitationPrompt :: (Maybe Prompt -> f (Maybe Prompt)) -> Slot -> f Slot
slot_valueElicitationPrompt = (Slot -> Maybe Prompt)
-> (Slot -> Maybe Prompt -> Slot)
-> Lens Slot Slot (Maybe Prompt) (Maybe Prompt)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Slot' {Maybe Prompt
valueElicitationPrompt :: Maybe Prompt
$sel:valueElicitationPrompt:Slot' :: Slot -> Maybe Prompt
valueElicitationPrompt} -> Maybe Prompt
valueElicitationPrompt) (\s :: Slot
s@Slot' {} Maybe Prompt
a -> Slot
s {$sel:valueElicitationPrompt:Slot' :: Maybe Prompt
valueElicitationPrompt = Maybe Prompt
a} :: Slot)

-- | A set of possible responses for the slot type used by text-based
-- clients. A user chooses an option from the response card, instead of
-- using text to reply.
slot_responseCard :: Lens.Lens' Slot (Prelude.Maybe Prelude.Text)
slot_responseCard :: (Maybe Text -> f (Maybe Text)) -> Slot -> f Slot
slot_responseCard = (Slot -> Maybe Text)
-> (Slot -> Maybe Text -> Slot)
-> Lens Slot Slot (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Slot' {Maybe Text
responseCard :: Maybe Text
$sel:responseCard:Slot' :: Slot -> Maybe Text
responseCard} -> Maybe Text
responseCard) (\s :: Slot
s@Slot' {} Maybe Text
a -> Slot
s {$sel:responseCard:Slot' :: Maybe Text
responseCard = Maybe Text
a} :: Slot)

-- | Directs Amazon Lex the order in which to elicit this slot value from the
-- user. For example, if the intent has two slots with priorities 1 and 2,
-- AWS Amazon Lex first elicits a value for the slot with priority 1.
--
-- If multiple slots share the same priority, the order in which Amazon Lex
-- elicits values is arbitrary.
slot_priority :: Lens.Lens' Slot (Prelude.Maybe Prelude.Natural)
slot_priority :: (Maybe Natural -> f (Maybe Natural)) -> Slot -> f Slot
slot_priority = (Slot -> Maybe Natural)
-> (Slot -> Maybe Natural -> Slot)
-> Lens Slot Slot (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Slot' {Maybe Natural
priority :: Maybe Natural
$sel:priority:Slot' :: Slot -> Maybe Natural
priority} -> Maybe Natural
priority) (\s :: Slot
s@Slot' {} Maybe Natural
a -> Slot
s {$sel:priority:Slot' :: Maybe Natural
priority = Maybe Natural
a} :: Slot)

-- | Determines whether a slot is obfuscated in conversation logs and stored
-- utterances. When you obfuscate a slot, the value is replaced by the slot
-- name in curly braces ({}). For example, if the slot name is
-- \"full_name\", obfuscated values are replaced with \"{full_name}\". For
-- more information, see
-- <https://docs.aws.amazon.com/lex/latest/dg/how-obfuscate.html Slot Obfuscation>
-- .
slot_obfuscationSetting :: Lens.Lens' Slot (Prelude.Maybe ObfuscationSetting)
slot_obfuscationSetting :: (Maybe ObfuscationSetting -> f (Maybe ObfuscationSetting))
-> Slot -> f Slot
slot_obfuscationSetting = (Slot -> Maybe ObfuscationSetting)
-> (Slot -> Maybe ObfuscationSetting -> Slot)
-> Lens
     Slot Slot (Maybe ObfuscationSetting) (Maybe ObfuscationSetting)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Slot' {Maybe ObfuscationSetting
obfuscationSetting :: Maybe ObfuscationSetting
$sel:obfuscationSetting:Slot' :: Slot -> Maybe ObfuscationSetting
obfuscationSetting} -> Maybe ObfuscationSetting
obfuscationSetting) (\s :: Slot
s@Slot' {} Maybe ObfuscationSetting
a -> Slot
s {$sel:obfuscationSetting:Slot' :: Maybe ObfuscationSetting
obfuscationSetting = Maybe ObfuscationSetting
a} :: Slot)

-- | A list of default values for the slot. Default values are used when
-- Amazon Lex hasn\'t determined a value for a slot. You can specify
-- default values from context variables, session attributes, and defined
-- values.
slot_defaultValueSpec :: Lens.Lens' Slot (Prelude.Maybe SlotDefaultValueSpec)
slot_defaultValueSpec :: (Maybe SlotDefaultValueSpec -> f (Maybe SlotDefaultValueSpec))
-> Slot -> f Slot
slot_defaultValueSpec = (Slot -> Maybe SlotDefaultValueSpec)
-> (Slot -> Maybe SlotDefaultValueSpec -> Slot)
-> Lens
     Slot Slot (Maybe SlotDefaultValueSpec) (Maybe SlotDefaultValueSpec)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Slot' {Maybe SlotDefaultValueSpec
defaultValueSpec :: Maybe SlotDefaultValueSpec
$sel:defaultValueSpec:Slot' :: Slot -> Maybe SlotDefaultValueSpec
defaultValueSpec} -> Maybe SlotDefaultValueSpec
defaultValueSpec) (\s :: Slot
s@Slot' {} Maybe SlotDefaultValueSpec
a -> Slot
s {$sel:defaultValueSpec:Slot' :: Maybe SlotDefaultValueSpec
defaultValueSpec = Maybe SlotDefaultValueSpec
a} :: Slot)

-- | The version of the slot type.
slot_slotTypeVersion :: Lens.Lens' Slot (Prelude.Maybe Prelude.Text)
slot_slotTypeVersion :: (Maybe Text -> f (Maybe Text)) -> Slot -> f Slot
slot_slotTypeVersion = (Slot -> Maybe Text)
-> (Slot -> Maybe Text -> Slot)
-> Lens Slot Slot (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Slot' {Maybe Text
slotTypeVersion :: Maybe Text
$sel:slotTypeVersion:Slot' :: Slot -> Maybe Text
slotTypeVersion} -> Maybe Text
slotTypeVersion) (\s :: Slot
s@Slot' {} Maybe Text
a -> Slot
s {$sel:slotTypeVersion:Slot' :: Maybe Text
slotTypeVersion = Maybe Text
a} :: Slot)

-- | If you know a specific pattern with which users might respond to an
-- Amazon Lex request for a slot value, you can provide those utterances to
-- improve accuracy. This is optional. In most cases, Amazon Lex is capable
-- of understanding user utterances.
slot_sampleUtterances :: Lens.Lens' Slot (Prelude.Maybe [Prelude.Text])
slot_sampleUtterances :: (Maybe [Text] -> f (Maybe [Text])) -> Slot -> f Slot
slot_sampleUtterances = (Slot -> Maybe [Text])
-> (Slot -> Maybe [Text] -> Slot)
-> Lens Slot Slot (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Slot' {Maybe [Text]
sampleUtterances :: Maybe [Text]
$sel:sampleUtterances:Slot' :: Slot -> Maybe [Text]
sampleUtterances} -> Maybe [Text]
sampleUtterances) (\s :: Slot
s@Slot' {} Maybe [Text]
a -> Slot
s {$sel:sampleUtterances:Slot' :: Maybe [Text]
sampleUtterances = Maybe [Text]
a} :: Slot) ((Maybe [Text] -> f (Maybe [Text])) -> Slot -> f Slot)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> Slot
-> f Slot
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A description of the slot.
slot_description :: Lens.Lens' Slot (Prelude.Maybe Prelude.Text)
slot_description :: (Maybe Text -> f (Maybe Text)) -> Slot -> f Slot
slot_description = (Slot -> Maybe Text)
-> (Slot -> Maybe Text -> Slot)
-> Lens Slot Slot (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Slot' {Maybe Text
description :: Maybe Text
$sel:description:Slot' :: Slot -> Maybe Text
description} -> Maybe Text
description) (\s :: Slot
s@Slot' {} Maybe Text
a -> Slot
s {$sel:description:Slot' :: Maybe Text
description = Maybe Text
a} :: Slot)

-- | The name of the slot.
slot_name :: Lens.Lens' Slot Prelude.Text
slot_name :: (Text -> f Text) -> Slot -> f Slot
slot_name = (Slot -> Text)
-> (Slot -> Text -> Slot) -> Lens Slot Slot Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Slot' {Text
name :: Text
$sel:name:Slot' :: Slot -> Text
name} -> Text
name) (\s :: Slot
s@Slot' {} Text
a -> Slot
s {$sel:name:Slot' :: Text
name = Text
a} :: Slot)

-- | Specifies whether the slot is required or optional.
slot_slotConstraint :: Lens.Lens' Slot SlotConstraint
slot_slotConstraint :: (SlotConstraint -> f SlotConstraint) -> Slot -> f Slot
slot_slotConstraint = (Slot -> SlotConstraint)
-> (Slot -> SlotConstraint -> Slot)
-> Lens Slot Slot SlotConstraint SlotConstraint
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Slot' {SlotConstraint
slotConstraint :: SlotConstraint
$sel:slotConstraint:Slot' :: Slot -> SlotConstraint
slotConstraint} -> SlotConstraint
slotConstraint) (\s :: Slot
s@Slot' {} SlotConstraint
a -> Slot
s {$sel:slotConstraint:Slot' :: SlotConstraint
slotConstraint = SlotConstraint
a} :: Slot)

instance Core.FromJSON Slot where
  parseJSON :: Value -> Parser Slot
parseJSON =
    String -> (Object -> Parser Slot) -> Value -> Parser Slot
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Slot"
      ( \Object
x ->
          Maybe Text
-> Maybe Prompt
-> Maybe Text
-> Maybe Natural
-> Maybe ObfuscationSetting
-> Maybe SlotDefaultValueSpec
-> Maybe Text
-> Maybe [Text]
-> Maybe Text
-> Text
-> SlotConstraint
-> Slot
Slot'
            (Maybe Text
 -> Maybe Prompt
 -> Maybe Text
 -> Maybe Natural
 -> Maybe ObfuscationSetting
 -> Maybe SlotDefaultValueSpec
 -> Maybe Text
 -> Maybe [Text]
 -> Maybe Text
 -> Text
 -> SlotConstraint
 -> Slot)
-> Parser (Maybe Text)
-> Parser
     (Maybe Prompt
      -> Maybe Text
      -> Maybe Natural
      -> Maybe ObfuscationSetting
      -> Maybe SlotDefaultValueSpec
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe Text
      -> Text
      -> SlotConstraint
      -> Slot)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"slotType")
            Parser
  (Maybe Prompt
   -> Maybe Text
   -> Maybe Natural
   -> Maybe ObfuscationSetting
   -> Maybe SlotDefaultValueSpec
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe Text
   -> Text
   -> SlotConstraint
   -> Slot)
-> Parser (Maybe Prompt)
-> Parser
     (Maybe Text
      -> Maybe Natural
      -> Maybe ObfuscationSetting
      -> Maybe SlotDefaultValueSpec
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe Text
      -> Text
      -> SlotConstraint
      -> Slot)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Prompt)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"valueElicitationPrompt")
            Parser
  (Maybe Text
   -> Maybe Natural
   -> Maybe ObfuscationSetting
   -> Maybe SlotDefaultValueSpec
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe Text
   -> Text
   -> SlotConstraint
   -> Slot)
-> Parser (Maybe Text)
-> Parser
     (Maybe Natural
      -> Maybe ObfuscationSetting
      -> Maybe SlotDefaultValueSpec
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe Text
      -> Text
      -> SlotConstraint
      -> Slot)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"responseCard")
            Parser
  (Maybe Natural
   -> Maybe ObfuscationSetting
   -> Maybe SlotDefaultValueSpec
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe Text
   -> Text
   -> SlotConstraint
   -> Slot)
-> Parser (Maybe Natural)
-> Parser
     (Maybe ObfuscationSetting
      -> Maybe SlotDefaultValueSpec
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe Text
      -> Text
      -> SlotConstraint
      -> Slot)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"priority")
            Parser
  (Maybe ObfuscationSetting
   -> Maybe SlotDefaultValueSpec
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe Text
   -> Text
   -> SlotConstraint
   -> Slot)
-> Parser (Maybe ObfuscationSetting)
-> Parser
     (Maybe SlotDefaultValueSpec
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe Text
      -> Text
      -> SlotConstraint
      -> Slot)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ObfuscationSetting)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"obfuscationSetting")
            Parser
  (Maybe SlotDefaultValueSpec
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe Text
   -> Text
   -> SlotConstraint
   -> Slot)
-> Parser (Maybe SlotDefaultValueSpec)
-> Parser
     (Maybe Text
      -> Maybe [Text] -> Maybe Text -> Text -> SlotConstraint -> Slot)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe SlotDefaultValueSpec)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"defaultValueSpec")
            Parser
  (Maybe Text
   -> Maybe [Text] -> Maybe Text -> Text -> SlotConstraint -> Slot)
-> Parser (Maybe Text)
-> Parser
     (Maybe [Text] -> Maybe Text -> Text -> SlotConstraint -> Slot)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"slotTypeVersion")
            Parser
  (Maybe [Text] -> Maybe Text -> Text -> SlotConstraint -> Slot)
-> Parser (Maybe [Text])
-> Parser (Maybe Text -> Text -> SlotConstraint -> Slot)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"sampleUtterances"
                            Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser (Maybe Text -> Text -> SlotConstraint -> Slot)
-> Parser (Maybe Text) -> Parser (Text -> SlotConstraint -> Slot)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"description")
            Parser (Text -> SlotConstraint -> Slot)
-> Parser Text -> Parser (SlotConstraint -> Slot)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"name")
            Parser (SlotConstraint -> Slot)
-> Parser SlotConstraint -> Parser Slot
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser SlotConstraint
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"slotConstraint")
      )

instance Prelude.Hashable Slot

instance Prelude.NFData Slot

instance Core.ToJSON Slot where
  toJSON :: Slot -> Value
toJSON Slot' {Maybe Natural
Maybe [Text]
Maybe Text
Maybe ObfuscationSetting
Maybe Prompt
Maybe SlotDefaultValueSpec
Text
SlotConstraint
slotConstraint :: SlotConstraint
name :: Text
description :: Maybe Text
sampleUtterances :: Maybe [Text]
slotTypeVersion :: Maybe Text
defaultValueSpec :: Maybe SlotDefaultValueSpec
obfuscationSetting :: Maybe ObfuscationSetting
priority :: Maybe Natural
responseCard :: Maybe Text
valueElicitationPrompt :: Maybe Prompt
slotType :: Maybe Text
$sel:slotConstraint:Slot' :: Slot -> SlotConstraint
$sel:name:Slot' :: Slot -> Text
$sel:description:Slot' :: Slot -> Maybe Text
$sel:sampleUtterances:Slot' :: Slot -> Maybe [Text]
$sel:slotTypeVersion:Slot' :: Slot -> Maybe Text
$sel:defaultValueSpec:Slot' :: Slot -> Maybe SlotDefaultValueSpec
$sel:obfuscationSetting:Slot' :: Slot -> Maybe ObfuscationSetting
$sel:priority:Slot' :: Slot -> Maybe Natural
$sel:responseCard:Slot' :: Slot -> Maybe Text
$sel:valueElicitationPrompt:Slot' :: Slot -> Maybe Prompt
$sel:slotType:Slot' :: Slot -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"slotType" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
slotType,
            (Text
"valueElicitationPrompt" Text -> Prompt -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Prompt -> Pair) -> Maybe Prompt -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Prompt
valueElicitationPrompt,
            (Text
"responseCard" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
responseCard,
            (Text
"priority" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
priority,
            (Text
"obfuscationSetting" Text -> ObfuscationSetting -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ObfuscationSetting -> Pair)
-> Maybe ObfuscationSetting -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ObfuscationSetting
obfuscationSetting,
            (Text
"defaultValueSpec" Text -> SlotDefaultValueSpec -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (SlotDefaultValueSpec -> Pair)
-> Maybe SlotDefaultValueSpec -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SlotDefaultValueSpec
defaultValueSpec,
            (Text
"slotTypeVersion" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
slotTypeVersion,
            (Text
"sampleUtterances" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([Text] -> Pair) -> Maybe [Text] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
sampleUtterances,
            (Text
"description" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"slotConstraint" Text -> SlotConstraint -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= SlotConstraint
slotConstraint)
          ]
      )