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

-- | A default value for a slot.
--
-- /See:/ 'newSlotDefaultValue' smart constructor.
data SlotDefaultValue = SlotDefaultValue'
  { -- | The default value for the slot. You can specify one of the following:
    --
    -- -   @#context-name.slot-name@ - The slot value \"slot-name\" in the
    --     context \"context-name.\"
    --
    -- -   @{attribute}@ - The slot value of the session attribute
    --     \"attribute.\"
    --
    -- -   @\'value\'@ - The discrete value \"value.\"
    SlotDefaultValue -> Text
defaultValue :: Prelude.Text
  }
  deriving (SlotDefaultValue -> SlotDefaultValue -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SlotDefaultValue -> SlotDefaultValue -> Bool
$c/= :: SlotDefaultValue -> SlotDefaultValue -> Bool
== :: SlotDefaultValue -> SlotDefaultValue -> Bool
$c== :: SlotDefaultValue -> SlotDefaultValue -> Bool
Prelude.Eq, ReadPrec [SlotDefaultValue]
ReadPrec SlotDefaultValue
Int -> ReadS SlotDefaultValue
ReadS [SlotDefaultValue]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SlotDefaultValue]
$creadListPrec :: ReadPrec [SlotDefaultValue]
readPrec :: ReadPrec SlotDefaultValue
$creadPrec :: ReadPrec SlotDefaultValue
readList :: ReadS [SlotDefaultValue]
$creadList :: ReadS [SlotDefaultValue]
readsPrec :: Int -> ReadS SlotDefaultValue
$creadsPrec :: Int -> ReadS SlotDefaultValue
Prelude.Read, Int -> SlotDefaultValue -> ShowS
[SlotDefaultValue] -> ShowS
SlotDefaultValue -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SlotDefaultValue] -> ShowS
$cshowList :: [SlotDefaultValue] -> ShowS
show :: SlotDefaultValue -> String
$cshow :: SlotDefaultValue -> String
showsPrec :: Int -> SlotDefaultValue -> ShowS
$cshowsPrec :: Int -> SlotDefaultValue -> ShowS
Prelude.Show, forall x. Rep SlotDefaultValue x -> SlotDefaultValue
forall x. SlotDefaultValue -> Rep SlotDefaultValue x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SlotDefaultValue x -> SlotDefaultValue
$cfrom :: forall x. SlotDefaultValue -> Rep SlotDefaultValue x
Prelude.Generic)

-- |
-- Create a value of 'SlotDefaultValue' 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:
--
-- 'defaultValue', 'slotDefaultValue_defaultValue' - The default value for the slot. You can specify one of the following:
--
-- -   @#context-name.slot-name@ - The slot value \"slot-name\" in the
--     context \"context-name.\"
--
-- -   @{attribute}@ - The slot value of the session attribute
--     \"attribute.\"
--
-- -   @\'value\'@ - The discrete value \"value.\"
newSlotDefaultValue ::
  -- | 'defaultValue'
  Prelude.Text ->
  SlotDefaultValue
newSlotDefaultValue :: Text -> SlotDefaultValue
newSlotDefaultValue Text
pDefaultValue_ =
  SlotDefaultValue' {$sel:defaultValue:SlotDefaultValue' :: Text
defaultValue = Text
pDefaultValue_}

-- | The default value for the slot. You can specify one of the following:
--
-- -   @#context-name.slot-name@ - The slot value \"slot-name\" in the
--     context \"context-name.\"
--
-- -   @{attribute}@ - The slot value of the session attribute
--     \"attribute.\"
--
-- -   @\'value\'@ - The discrete value \"value.\"
slotDefaultValue_defaultValue :: Lens.Lens' SlotDefaultValue Prelude.Text
slotDefaultValue_defaultValue :: Lens' SlotDefaultValue Text
slotDefaultValue_defaultValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SlotDefaultValue' {Text
defaultValue :: Text
$sel:defaultValue:SlotDefaultValue' :: SlotDefaultValue -> Text
defaultValue} -> Text
defaultValue) (\s :: SlotDefaultValue
s@SlotDefaultValue' {} Text
a -> SlotDefaultValue
s {$sel:defaultValue:SlotDefaultValue' :: Text
defaultValue = Text
a} :: SlotDefaultValue)

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

instance Prelude.Hashable SlotDefaultValue where
  hashWithSalt :: Int -> SlotDefaultValue -> Int
hashWithSalt Int
_salt SlotDefaultValue' {Text
defaultValue :: Text
$sel:defaultValue:SlotDefaultValue' :: SlotDefaultValue -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
defaultValue

instance Prelude.NFData SlotDefaultValue where
  rnf :: SlotDefaultValue -> ()
rnf SlotDefaultValue' {Text
defaultValue :: Text
$sel:defaultValue:SlotDefaultValue' :: SlotDefaultValue -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
defaultValue

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