{-# 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.MultipleValuesSetting
-- 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.MultipleValuesSetting 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

-- | Indicates whether a slot can return multiple values.
--
-- /See:/ 'newMultipleValuesSetting' smart constructor.
data MultipleValuesSetting = MultipleValuesSetting'
  { -- | Indicates whether a slot can return multiple values. When @true@, the
    -- slot may return more than one value in a response. When @false@, the
    -- slot returns only a single value.
    --
    -- Multi-value slots are only available in the en-US locale. If you set
    -- this value to @true@ in any other locale, Amazon Lex throws a
    -- @ValidationException@.
    --
    -- If the @allowMutlipleValues@ is not set, the default value is @false@.
    MultipleValuesSetting -> Maybe Bool
allowMultipleValues :: Prelude.Maybe Prelude.Bool
  }
  deriving (MultipleValuesSetting -> MultipleValuesSetting -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MultipleValuesSetting -> MultipleValuesSetting -> Bool
$c/= :: MultipleValuesSetting -> MultipleValuesSetting -> Bool
== :: MultipleValuesSetting -> MultipleValuesSetting -> Bool
$c== :: MultipleValuesSetting -> MultipleValuesSetting -> Bool
Prelude.Eq, ReadPrec [MultipleValuesSetting]
ReadPrec MultipleValuesSetting
Int -> ReadS MultipleValuesSetting
ReadS [MultipleValuesSetting]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MultipleValuesSetting]
$creadListPrec :: ReadPrec [MultipleValuesSetting]
readPrec :: ReadPrec MultipleValuesSetting
$creadPrec :: ReadPrec MultipleValuesSetting
readList :: ReadS [MultipleValuesSetting]
$creadList :: ReadS [MultipleValuesSetting]
readsPrec :: Int -> ReadS MultipleValuesSetting
$creadsPrec :: Int -> ReadS MultipleValuesSetting
Prelude.Read, Int -> MultipleValuesSetting -> ShowS
[MultipleValuesSetting] -> ShowS
MultipleValuesSetting -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MultipleValuesSetting] -> ShowS
$cshowList :: [MultipleValuesSetting] -> ShowS
show :: MultipleValuesSetting -> String
$cshow :: MultipleValuesSetting -> String
showsPrec :: Int -> MultipleValuesSetting -> ShowS
$cshowsPrec :: Int -> MultipleValuesSetting -> ShowS
Prelude.Show, forall x. Rep MultipleValuesSetting x -> MultipleValuesSetting
forall x. MultipleValuesSetting -> Rep MultipleValuesSetting x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MultipleValuesSetting x -> MultipleValuesSetting
$cfrom :: forall x. MultipleValuesSetting -> Rep MultipleValuesSetting x
Prelude.Generic)

-- |
-- Create a value of 'MultipleValuesSetting' 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:
--
-- 'allowMultipleValues', 'multipleValuesSetting_allowMultipleValues' - Indicates whether a slot can return multiple values. When @true@, the
-- slot may return more than one value in a response. When @false@, the
-- slot returns only a single value.
--
-- Multi-value slots are only available in the en-US locale. If you set
-- this value to @true@ in any other locale, Amazon Lex throws a
-- @ValidationException@.
--
-- If the @allowMutlipleValues@ is not set, the default value is @false@.
newMultipleValuesSetting ::
  MultipleValuesSetting
newMultipleValuesSetting :: MultipleValuesSetting
newMultipleValuesSetting =
  MultipleValuesSetting'
    { $sel:allowMultipleValues:MultipleValuesSetting' :: Maybe Bool
allowMultipleValues =
        forall a. Maybe a
Prelude.Nothing
    }

-- | Indicates whether a slot can return multiple values. When @true@, the
-- slot may return more than one value in a response. When @false@, the
-- slot returns only a single value.
--
-- Multi-value slots are only available in the en-US locale. If you set
-- this value to @true@ in any other locale, Amazon Lex throws a
-- @ValidationException@.
--
-- If the @allowMutlipleValues@ is not set, the default value is @false@.
multipleValuesSetting_allowMultipleValues :: Lens.Lens' MultipleValuesSetting (Prelude.Maybe Prelude.Bool)
multipleValuesSetting_allowMultipleValues :: Lens' MultipleValuesSetting (Maybe Bool)
multipleValuesSetting_allowMultipleValues = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MultipleValuesSetting' {Maybe Bool
allowMultipleValues :: Maybe Bool
$sel:allowMultipleValues:MultipleValuesSetting' :: MultipleValuesSetting -> Maybe Bool
allowMultipleValues} -> Maybe Bool
allowMultipleValues) (\s :: MultipleValuesSetting
s@MultipleValuesSetting' {} Maybe Bool
a -> MultipleValuesSetting
s {$sel:allowMultipleValues:MultipleValuesSetting' :: Maybe Bool
allowMultipleValues = Maybe Bool
a} :: MultipleValuesSetting)

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

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

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

instance Data.ToJSON MultipleValuesSetting where
  toJSON :: MultipleValuesSetting -> Value
toJSON MultipleValuesSetting' {Maybe Bool
allowMultipleValues :: Maybe Bool
$sel:allowMultipleValues:MultipleValuesSetting' :: MultipleValuesSetting -> Maybe Bool
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"allowMultipleValues" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
allowMultipleValues
          ]
      )