{-# 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.BuiltinSlotTypeMetadata
-- 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.BuiltinSlotTypeMetadata where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.LexModels.Types.Locale
import qualified Amazonka.Prelude as Prelude

-- | Provides information about a built in slot type.
--
-- /See:/ 'newBuiltinSlotTypeMetadata' smart constructor.
data BuiltinSlotTypeMetadata = BuiltinSlotTypeMetadata'
  { -- | A unique identifier for the built-in slot type. To find the signature
    -- for a slot type, see
    -- <https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/built-in-intent-ref/slot-type-reference Slot Type Reference>
    -- in the /Alexa Skills Kit/.
    BuiltinSlotTypeMetadata -> Maybe Text
signature :: Prelude.Maybe Prelude.Text,
    -- | A list of target locales for the slot.
    BuiltinSlotTypeMetadata -> Maybe [Locale]
supportedLocales :: Prelude.Maybe [Locale]
  }
  deriving (BuiltinSlotTypeMetadata -> BuiltinSlotTypeMetadata -> Bool
(BuiltinSlotTypeMetadata -> BuiltinSlotTypeMetadata -> Bool)
-> (BuiltinSlotTypeMetadata -> BuiltinSlotTypeMetadata -> Bool)
-> Eq BuiltinSlotTypeMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BuiltinSlotTypeMetadata -> BuiltinSlotTypeMetadata -> Bool
$c/= :: BuiltinSlotTypeMetadata -> BuiltinSlotTypeMetadata -> Bool
== :: BuiltinSlotTypeMetadata -> BuiltinSlotTypeMetadata -> Bool
$c== :: BuiltinSlotTypeMetadata -> BuiltinSlotTypeMetadata -> Bool
Prelude.Eq, ReadPrec [BuiltinSlotTypeMetadata]
ReadPrec BuiltinSlotTypeMetadata
Int -> ReadS BuiltinSlotTypeMetadata
ReadS [BuiltinSlotTypeMetadata]
(Int -> ReadS BuiltinSlotTypeMetadata)
-> ReadS [BuiltinSlotTypeMetadata]
-> ReadPrec BuiltinSlotTypeMetadata
-> ReadPrec [BuiltinSlotTypeMetadata]
-> Read BuiltinSlotTypeMetadata
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BuiltinSlotTypeMetadata]
$creadListPrec :: ReadPrec [BuiltinSlotTypeMetadata]
readPrec :: ReadPrec BuiltinSlotTypeMetadata
$creadPrec :: ReadPrec BuiltinSlotTypeMetadata
readList :: ReadS [BuiltinSlotTypeMetadata]
$creadList :: ReadS [BuiltinSlotTypeMetadata]
readsPrec :: Int -> ReadS BuiltinSlotTypeMetadata
$creadsPrec :: Int -> ReadS BuiltinSlotTypeMetadata
Prelude.Read, Int -> BuiltinSlotTypeMetadata -> ShowS
[BuiltinSlotTypeMetadata] -> ShowS
BuiltinSlotTypeMetadata -> String
(Int -> BuiltinSlotTypeMetadata -> ShowS)
-> (BuiltinSlotTypeMetadata -> String)
-> ([BuiltinSlotTypeMetadata] -> ShowS)
-> Show BuiltinSlotTypeMetadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BuiltinSlotTypeMetadata] -> ShowS
$cshowList :: [BuiltinSlotTypeMetadata] -> ShowS
show :: BuiltinSlotTypeMetadata -> String
$cshow :: BuiltinSlotTypeMetadata -> String
showsPrec :: Int -> BuiltinSlotTypeMetadata -> ShowS
$cshowsPrec :: Int -> BuiltinSlotTypeMetadata -> ShowS
Prelude.Show, (forall x.
 BuiltinSlotTypeMetadata -> Rep BuiltinSlotTypeMetadata x)
-> (forall x.
    Rep BuiltinSlotTypeMetadata x -> BuiltinSlotTypeMetadata)
-> Generic BuiltinSlotTypeMetadata
forall x. Rep BuiltinSlotTypeMetadata x -> BuiltinSlotTypeMetadata
forall x. BuiltinSlotTypeMetadata -> Rep BuiltinSlotTypeMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BuiltinSlotTypeMetadata x -> BuiltinSlotTypeMetadata
$cfrom :: forall x. BuiltinSlotTypeMetadata -> Rep BuiltinSlotTypeMetadata x
Prelude.Generic)

-- |
-- Create a value of 'BuiltinSlotTypeMetadata' 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:
--
-- 'signature', 'builtinSlotTypeMetadata_signature' - A unique identifier for the built-in slot type. To find the signature
-- for a slot type, see
-- <https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/built-in-intent-ref/slot-type-reference Slot Type Reference>
-- in the /Alexa Skills Kit/.
--
-- 'supportedLocales', 'builtinSlotTypeMetadata_supportedLocales' - A list of target locales for the slot.
newBuiltinSlotTypeMetadata ::
  BuiltinSlotTypeMetadata
newBuiltinSlotTypeMetadata :: BuiltinSlotTypeMetadata
newBuiltinSlotTypeMetadata =
  BuiltinSlotTypeMetadata' :: Maybe Text -> Maybe [Locale] -> BuiltinSlotTypeMetadata
BuiltinSlotTypeMetadata'
    { $sel:signature:BuiltinSlotTypeMetadata' :: Maybe Text
signature =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:supportedLocales:BuiltinSlotTypeMetadata' :: Maybe [Locale]
supportedLocales = Maybe [Locale]
forall a. Maybe a
Prelude.Nothing
    }

-- | A unique identifier for the built-in slot type. To find the signature
-- for a slot type, see
-- <https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/built-in-intent-ref/slot-type-reference Slot Type Reference>
-- in the /Alexa Skills Kit/.
builtinSlotTypeMetadata_signature :: Lens.Lens' BuiltinSlotTypeMetadata (Prelude.Maybe Prelude.Text)
builtinSlotTypeMetadata_signature :: (Maybe Text -> f (Maybe Text))
-> BuiltinSlotTypeMetadata -> f BuiltinSlotTypeMetadata
builtinSlotTypeMetadata_signature = (BuiltinSlotTypeMetadata -> Maybe Text)
-> (BuiltinSlotTypeMetadata
    -> Maybe Text -> BuiltinSlotTypeMetadata)
-> Lens
     BuiltinSlotTypeMetadata
     BuiltinSlotTypeMetadata
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BuiltinSlotTypeMetadata' {Maybe Text
signature :: Maybe Text
$sel:signature:BuiltinSlotTypeMetadata' :: BuiltinSlotTypeMetadata -> Maybe Text
signature} -> Maybe Text
signature) (\s :: BuiltinSlotTypeMetadata
s@BuiltinSlotTypeMetadata' {} Maybe Text
a -> BuiltinSlotTypeMetadata
s {$sel:signature:BuiltinSlotTypeMetadata' :: Maybe Text
signature = Maybe Text
a} :: BuiltinSlotTypeMetadata)

-- | A list of target locales for the slot.
builtinSlotTypeMetadata_supportedLocales :: Lens.Lens' BuiltinSlotTypeMetadata (Prelude.Maybe [Locale])
builtinSlotTypeMetadata_supportedLocales :: (Maybe [Locale] -> f (Maybe [Locale]))
-> BuiltinSlotTypeMetadata -> f BuiltinSlotTypeMetadata
builtinSlotTypeMetadata_supportedLocales = (BuiltinSlotTypeMetadata -> Maybe [Locale])
-> (BuiltinSlotTypeMetadata
    -> Maybe [Locale] -> BuiltinSlotTypeMetadata)
-> Lens
     BuiltinSlotTypeMetadata
     BuiltinSlotTypeMetadata
     (Maybe [Locale])
     (Maybe [Locale])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BuiltinSlotTypeMetadata' {Maybe [Locale]
supportedLocales :: Maybe [Locale]
$sel:supportedLocales:BuiltinSlotTypeMetadata' :: BuiltinSlotTypeMetadata -> Maybe [Locale]
supportedLocales} -> Maybe [Locale]
supportedLocales) (\s :: BuiltinSlotTypeMetadata
s@BuiltinSlotTypeMetadata' {} Maybe [Locale]
a -> BuiltinSlotTypeMetadata
s {$sel:supportedLocales:BuiltinSlotTypeMetadata' :: Maybe [Locale]
supportedLocales = Maybe [Locale]
a} :: BuiltinSlotTypeMetadata) ((Maybe [Locale] -> f (Maybe [Locale]))
 -> BuiltinSlotTypeMetadata -> f BuiltinSlotTypeMetadata)
-> ((Maybe [Locale] -> f (Maybe [Locale]))
    -> Maybe [Locale] -> f (Maybe [Locale]))
-> (Maybe [Locale] -> f (Maybe [Locale]))
-> BuiltinSlotTypeMetadata
-> f BuiltinSlotTypeMetadata
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Locale] [Locale] [Locale] [Locale]
-> Iso
     (Maybe [Locale]) (Maybe [Locale]) (Maybe [Locale]) (Maybe [Locale])
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 [Locale] [Locale] [Locale] [Locale]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON BuiltinSlotTypeMetadata where
  parseJSON :: Value -> Parser BuiltinSlotTypeMetadata
parseJSON =
    String
-> (Object -> Parser BuiltinSlotTypeMetadata)
-> Value
-> Parser BuiltinSlotTypeMetadata
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"BuiltinSlotTypeMetadata"
      ( \Object
x ->
          Maybe Text -> Maybe [Locale] -> BuiltinSlotTypeMetadata
BuiltinSlotTypeMetadata'
            (Maybe Text -> Maybe [Locale] -> BuiltinSlotTypeMetadata)
-> Parser (Maybe Text)
-> Parser (Maybe [Locale] -> BuiltinSlotTypeMetadata)
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
"signature")
            Parser (Maybe [Locale] -> BuiltinSlotTypeMetadata)
-> Parser (Maybe [Locale]) -> Parser BuiltinSlotTypeMetadata
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [Locale]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"supportedLocales"
                            Parser (Maybe (Maybe [Locale]))
-> Maybe [Locale] -> Parser (Maybe [Locale])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Locale]
forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable BuiltinSlotTypeMetadata

instance Prelude.NFData BuiltinSlotTypeMetadata