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

-- | A composite slot is a combination of two or more slots that capture
-- multiple pieces of information in a single user input.
--
-- /See:/ 'newCompositeSlotTypeSetting' smart constructor.
data CompositeSlotTypeSetting = CompositeSlotTypeSetting'
  { -- | Subslots in the composite slot.
    CompositeSlotTypeSetting -> Maybe [SubSlotTypeComposition]
subSlots :: Prelude.Maybe [SubSlotTypeComposition]
  }
  deriving (CompositeSlotTypeSetting -> CompositeSlotTypeSetting -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CompositeSlotTypeSetting -> CompositeSlotTypeSetting -> Bool
$c/= :: CompositeSlotTypeSetting -> CompositeSlotTypeSetting -> Bool
== :: CompositeSlotTypeSetting -> CompositeSlotTypeSetting -> Bool
$c== :: CompositeSlotTypeSetting -> CompositeSlotTypeSetting -> Bool
Prelude.Eq, ReadPrec [CompositeSlotTypeSetting]
ReadPrec CompositeSlotTypeSetting
Int -> ReadS CompositeSlotTypeSetting
ReadS [CompositeSlotTypeSetting]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CompositeSlotTypeSetting]
$creadListPrec :: ReadPrec [CompositeSlotTypeSetting]
readPrec :: ReadPrec CompositeSlotTypeSetting
$creadPrec :: ReadPrec CompositeSlotTypeSetting
readList :: ReadS [CompositeSlotTypeSetting]
$creadList :: ReadS [CompositeSlotTypeSetting]
readsPrec :: Int -> ReadS CompositeSlotTypeSetting
$creadsPrec :: Int -> ReadS CompositeSlotTypeSetting
Prelude.Read, Int -> CompositeSlotTypeSetting -> ShowS
[CompositeSlotTypeSetting] -> ShowS
CompositeSlotTypeSetting -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CompositeSlotTypeSetting] -> ShowS
$cshowList :: [CompositeSlotTypeSetting] -> ShowS
show :: CompositeSlotTypeSetting -> String
$cshow :: CompositeSlotTypeSetting -> String
showsPrec :: Int -> CompositeSlotTypeSetting -> ShowS
$cshowsPrec :: Int -> CompositeSlotTypeSetting -> ShowS
Prelude.Show, forall x.
Rep CompositeSlotTypeSetting x -> CompositeSlotTypeSetting
forall x.
CompositeSlotTypeSetting -> Rep CompositeSlotTypeSetting x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CompositeSlotTypeSetting x -> CompositeSlotTypeSetting
$cfrom :: forall x.
CompositeSlotTypeSetting -> Rep CompositeSlotTypeSetting x
Prelude.Generic)

-- |
-- Create a value of 'CompositeSlotTypeSetting' 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:
--
-- 'subSlots', 'compositeSlotTypeSetting_subSlots' - Subslots in the composite slot.
newCompositeSlotTypeSetting ::
  CompositeSlotTypeSetting
newCompositeSlotTypeSetting :: CompositeSlotTypeSetting
newCompositeSlotTypeSetting =
  CompositeSlotTypeSetting'
    { $sel:subSlots:CompositeSlotTypeSetting' :: Maybe [SubSlotTypeComposition]
subSlots =
        forall a. Maybe a
Prelude.Nothing
    }

-- | Subslots in the composite slot.
compositeSlotTypeSetting_subSlots :: Lens.Lens' CompositeSlotTypeSetting (Prelude.Maybe [SubSlotTypeComposition])
compositeSlotTypeSetting_subSlots :: Lens' CompositeSlotTypeSetting (Maybe [SubSlotTypeComposition])
compositeSlotTypeSetting_subSlots = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CompositeSlotTypeSetting' {Maybe [SubSlotTypeComposition]
subSlots :: Maybe [SubSlotTypeComposition]
$sel:subSlots:CompositeSlotTypeSetting' :: CompositeSlotTypeSetting -> Maybe [SubSlotTypeComposition]
subSlots} -> Maybe [SubSlotTypeComposition]
subSlots) (\s :: CompositeSlotTypeSetting
s@CompositeSlotTypeSetting' {} Maybe [SubSlotTypeComposition]
a -> CompositeSlotTypeSetting
s {$sel:subSlots:CompositeSlotTypeSetting' :: Maybe [SubSlotTypeComposition]
subSlots = Maybe [SubSlotTypeComposition]
a} :: CompositeSlotTypeSetting) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON CompositeSlotTypeSetting where
  parseJSON :: Value -> Parser CompositeSlotTypeSetting
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"CompositeSlotTypeSetting"
      ( \Object
x ->
          Maybe [SubSlotTypeComposition] -> CompositeSlotTypeSetting
CompositeSlotTypeSetting'
            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
"subSlots" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable CompositeSlotTypeSetting where
  hashWithSalt :: Int -> CompositeSlotTypeSetting -> Int
hashWithSalt Int
_salt CompositeSlotTypeSetting' {Maybe [SubSlotTypeComposition]
subSlots :: Maybe [SubSlotTypeComposition]
$sel:subSlots:CompositeSlotTypeSetting' :: CompositeSlotTypeSetting -> Maybe [SubSlotTypeComposition]
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [SubSlotTypeComposition]
subSlots

instance Prelude.NFData CompositeSlotTypeSetting where
  rnf :: CompositeSlotTypeSetting -> ()
rnf CompositeSlotTypeSetting' {Maybe [SubSlotTypeComposition]
subSlots :: Maybe [SubSlotTypeComposition]
$sel:subSlots:CompositeSlotTypeSetting' :: CompositeSlotTypeSetting -> Maybe [SubSlotTypeComposition]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [SubSlotTypeComposition]
subSlots

instance Data.ToJSON CompositeSlotTypeSetting where
  toJSON :: CompositeSlotTypeSetting -> Value
toJSON CompositeSlotTypeSetting' {Maybe [SubSlotTypeComposition]
subSlots :: Maybe [SubSlotTypeComposition]
$sel:subSlots:CompositeSlotTypeSetting' :: CompositeSlotTypeSetting -> Maybe [SubSlotTypeComposition]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Key
"subSlots" 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 [SubSlotTypeComposition]
subSlots]
      )