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

-- | Defines a list of values that Amazon Lex should use as the default value
-- for a slot.
--
-- /See:/ 'newSlotDefaultValueSpecification' smart constructor.
data SlotDefaultValueSpecification = SlotDefaultValueSpecification'
  { -- | A list of default values. Amazon Lex chooses the default value to use in
    -- the order that they are presented in the list.
    SlotDefaultValueSpecification -> [SlotDefaultValue]
defaultValueList :: [SlotDefaultValue]
  }
  deriving (SlotDefaultValueSpecification
-> SlotDefaultValueSpecification -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SlotDefaultValueSpecification
-> SlotDefaultValueSpecification -> Bool
$c/= :: SlotDefaultValueSpecification
-> SlotDefaultValueSpecification -> Bool
== :: SlotDefaultValueSpecification
-> SlotDefaultValueSpecification -> Bool
$c== :: SlotDefaultValueSpecification
-> SlotDefaultValueSpecification -> Bool
Prelude.Eq, ReadPrec [SlotDefaultValueSpecification]
ReadPrec SlotDefaultValueSpecification
Int -> ReadS SlotDefaultValueSpecification
ReadS [SlotDefaultValueSpecification]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SlotDefaultValueSpecification]
$creadListPrec :: ReadPrec [SlotDefaultValueSpecification]
readPrec :: ReadPrec SlotDefaultValueSpecification
$creadPrec :: ReadPrec SlotDefaultValueSpecification
readList :: ReadS [SlotDefaultValueSpecification]
$creadList :: ReadS [SlotDefaultValueSpecification]
readsPrec :: Int -> ReadS SlotDefaultValueSpecification
$creadsPrec :: Int -> ReadS SlotDefaultValueSpecification
Prelude.Read, Int -> SlotDefaultValueSpecification -> ShowS
[SlotDefaultValueSpecification] -> ShowS
SlotDefaultValueSpecification -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SlotDefaultValueSpecification] -> ShowS
$cshowList :: [SlotDefaultValueSpecification] -> ShowS
show :: SlotDefaultValueSpecification -> String
$cshow :: SlotDefaultValueSpecification -> String
showsPrec :: Int -> SlotDefaultValueSpecification -> ShowS
$cshowsPrec :: Int -> SlotDefaultValueSpecification -> ShowS
Prelude.Show, forall x.
Rep SlotDefaultValueSpecification x
-> SlotDefaultValueSpecification
forall x.
SlotDefaultValueSpecification
-> Rep SlotDefaultValueSpecification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SlotDefaultValueSpecification x
-> SlotDefaultValueSpecification
$cfrom :: forall x.
SlotDefaultValueSpecification
-> Rep SlotDefaultValueSpecification x
Prelude.Generic)

-- |
-- Create a value of 'SlotDefaultValueSpecification' 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:
--
-- 'defaultValueList', 'slotDefaultValueSpecification_defaultValueList' - A list of default values. Amazon Lex chooses the default value to use in
-- the order that they are presented in the list.
newSlotDefaultValueSpecification ::
  SlotDefaultValueSpecification
newSlotDefaultValueSpecification :: SlotDefaultValueSpecification
newSlotDefaultValueSpecification =
  SlotDefaultValueSpecification'
    { $sel:defaultValueList:SlotDefaultValueSpecification' :: [SlotDefaultValue]
defaultValueList =
        forall a. Monoid a => a
Prelude.mempty
    }

-- | A list of default values. Amazon Lex chooses the default value to use in
-- the order that they are presented in the list.
slotDefaultValueSpecification_defaultValueList :: Lens.Lens' SlotDefaultValueSpecification [SlotDefaultValue]
slotDefaultValueSpecification_defaultValueList :: Lens' SlotDefaultValueSpecification [SlotDefaultValue]
slotDefaultValueSpecification_defaultValueList = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SlotDefaultValueSpecification' {[SlotDefaultValue]
defaultValueList :: [SlotDefaultValue]
$sel:defaultValueList:SlotDefaultValueSpecification' :: SlotDefaultValueSpecification -> [SlotDefaultValue]
defaultValueList} -> [SlotDefaultValue]
defaultValueList) (\s :: SlotDefaultValueSpecification
s@SlotDefaultValueSpecification' {} [SlotDefaultValue]
a -> SlotDefaultValueSpecification
s {$sel:defaultValueList:SlotDefaultValueSpecification' :: [SlotDefaultValue]
defaultValueList = [SlotDefaultValue]
a} :: SlotDefaultValueSpecification) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON SlotDefaultValueSpecification where
  parseJSON :: Value -> Parser SlotDefaultValueSpecification
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SlotDefaultValueSpecification"
      ( \Object
x ->
          [SlotDefaultValue] -> SlotDefaultValueSpecification
SlotDefaultValueSpecification'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"defaultValueList"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance
  Prelude.Hashable
    SlotDefaultValueSpecification
  where
  hashWithSalt :: Int -> SlotDefaultValueSpecification -> Int
hashWithSalt Int
_salt SlotDefaultValueSpecification' {[SlotDefaultValue]
defaultValueList :: [SlotDefaultValue]
$sel:defaultValueList:SlotDefaultValueSpecification' :: SlotDefaultValueSpecification -> [SlotDefaultValue]
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [SlotDefaultValue]
defaultValueList

instance Prelude.NFData SlotDefaultValueSpecification where
  rnf :: SlotDefaultValueSpecification -> ()
rnf SlotDefaultValueSpecification' {[SlotDefaultValue]
defaultValueList :: [SlotDefaultValue]
$sel:defaultValueList:SlotDefaultValueSpecification' :: SlotDefaultValueSpecification -> [SlotDefaultValue]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf [SlotDefaultValue]
defaultValueList

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