{-# 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.BuiltinIntentMetadata
-- 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.BuiltinIntentMetadata 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 metadata for a built-in intent.
--
-- /See:/ 'newBuiltinIntentMetadata' smart constructor.
data BuiltinIntentMetadata = BuiltinIntentMetadata'
  { -- | A unique identifier for the built-in intent. To find the signature for
    -- an intent, see
    -- <https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/built-in-intent-ref/standard-intents Standard Built-in Intents>
    -- in the /Alexa Skills Kit/.
    BuiltinIntentMetadata -> Maybe Text
signature :: Prelude.Maybe Prelude.Text,
    -- | A list of identifiers for the locales that the intent supports.
    BuiltinIntentMetadata -> Maybe [Locale]
supportedLocales :: Prelude.Maybe [Locale]
  }
  deriving (BuiltinIntentMetadata -> BuiltinIntentMetadata -> Bool
(BuiltinIntentMetadata -> BuiltinIntentMetadata -> Bool)
-> (BuiltinIntentMetadata -> BuiltinIntentMetadata -> Bool)
-> Eq BuiltinIntentMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BuiltinIntentMetadata -> BuiltinIntentMetadata -> Bool
$c/= :: BuiltinIntentMetadata -> BuiltinIntentMetadata -> Bool
== :: BuiltinIntentMetadata -> BuiltinIntentMetadata -> Bool
$c== :: BuiltinIntentMetadata -> BuiltinIntentMetadata -> Bool
Prelude.Eq, ReadPrec [BuiltinIntentMetadata]
ReadPrec BuiltinIntentMetadata
Int -> ReadS BuiltinIntentMetadata
ReadS [BuiltinIntentMetadata]
(Int -> ReadS BuiltinIntentMetadata)
-> ReadS [BuiltinIntentMetadata]
-> ReadPrec BuiltinIntentMetadata
-> ReadPrec [BuiltinIntentMetadata]
-> Read BuiltinIntentMetadata
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BuiltinIntentMetadata]
$creadListPrec :: ReadPrec [BuiltinIntentMetadata]
readPrec :: ReadPrec BuiltinIntentMetadata
$creadPrec :: ReadPrec BuiltinIntentMetadata
readList :: ReadS [BuiltinIntentMetadata]
$creadList :: ReadS [BuiltinIntentMetadata]
readsPrec :: Int -> ReadS BuiltinIntentMetadata
$creadsPrec :: Int -> ReadS BuiltinIntentMetadata
Prelude.Read, Int -> BuiltinIntentMetadata -> ShowS
[BuiltinIntentMetadata] -> ShowS
BuiltinIntentMetadata -> String
(Int -> BuiltinIntentMetadata -> ShowS)
-> (BuiltinIntentMetadata -> String)
-> ([BuiltinIntentMetadata] -> ShowS)
-> Show BuiltinIntentMetadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BuiltinIntentMetadata] -> ShowS
$cshowList :: [BuiltinIntentMetadata] -> ShowS
show :: BuiltinIntentMetadata -> String
$cshow :: BuiltinIntentMetadata -> String
showsPrec :: Int -> BuiltinIntentMetadata -> ShowS
$cshowsPrec :: Int -> BuiltinIntentMetadata -> ShowS
Prelude.Show, (forall x. BuiltinIntentMetadata -> Rep BuiltinIntentMetadata x)
-> (forall x. Rep BuiltinIntentMetadata x -> BuiltinIntentMetadata)
-> Generic BuiltinIntentMetadata
forall x. Rep BuiltinIntentMetadata x -> BuiltinIntentMetadata
forall x. BuiltinIntentMetadata -> Rep BuiltinIntentMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BuiltinIntentMetadata x -> BuiltinIntentMetadata
$cfrom :: forall x. BuiltinIntentMetadata -> Rep BuiltinIntentMetadata x
Prelude.Generic)

-- |
-- Create a value of 'BuiltinIntentMetadata' 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', 'builtinIntentMetadata_signature' - A unique identifier for the built-in intent. To find the signature for
-- an intent, see
-- <https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/built-in-intent-ref/standard-intents Standard Built-in Intents>
-- in the /Alexa Skills Kit/.
--
-- 'supportedLocales', 'builtinIntentMetadata_supportedLocales' - A list of identifiers for the locales that the intent supports.
newBuiltinIntentMetadata ::
  BuiltinIntentMetadata
newBuiltinIntentMetadata :: BuiltinIntentMetadata
newBuiltinIntentMetadata =
  BuiltinIntentMetadata' :: Maybe Text -> Maybe [Locale] -> BuiltinIntentMetadata
BuiltinIntentMetadata'
    { $sel:signature:BuiltinIntentMetadata' :: Maybe Text
signature = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:supportedLocales:BuiltinIntentMetadata' :: Maybe [Locale]
supportedLocales = Maybe [Locale]
forall a. Maybe a
Prelude.Nothing
    }

-- | A unique identifier for the built-in intent. To find the signature for
-- an intent, see
-- <https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/built-in-intent-ref/standard-intents Standard Built-in Intents>
-- in the /Alexa Skills Kit/.
builtinIntentMetadata_signature :: Lens.Lens' BuiltinIntentMetadata (Prelude.Maybe Prelude.Text)
builtinIntentMetadata_signature :: (Maybe Text -> f (Maybe Text))
-> BuiltinIntentMetadata -> f BuiltinIntentMetadata
builtinIntentMetadata_signature = (BuiltinIntentMetadata -> Maybe Text)
-> (BuiltinIntentMetadata -> Maybe Text -> BuiltinIntentMetadata)
-> Lens
     BuiltinIntentMetadata
     BuiltinIntentMetadata
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BuiltinIntentMetadata' {Maybe Text
signature :: Maybe Text
$sel:signature:BuiltinIntentMetadata' :: BuiltinIntentMetadata -> Maybe Text
signature} -> Maybe Text
signature) (\s :: BuiltinIntentMetadata
s@BuiltinIntentMetadata' {} Maybe Text
a -> BuiltinIntentMetadata
s {$sel:signature:BuiltinIntentMetadata' :: Maybe Text
signature = Maybe Text
a} :: BuiltinIntentMetadata)

-- | A list of identifiers for the locales that the intent supports.
builtinIntentMetadata_supportedLocales :: Lens.Lens' BuiltinIntentMetadata (Prelude.Maybe [Locale])
builtinIntentMetadata_supportedLocales :: (Maybe [Locale] -> f (Maybe [Locale]))
-> BuiltinIntentMetadata -> f BuiltinIntentMetadata
builtinIntentMetadata_supportedLocales = (BuiltinIntentMetadata -> Maybe [Locale])
-> (BuiltinIntentMetadata
    -> Maybe [Locale] -> BuiltinIntentMetadata)
-> Lens
     BuiltinIntentMetadata
     BuiltinIntentMetadata
     (Maybe [Locale])
     (Maybe [Locale])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BuiltinIntentMetadata' {Maybe [Locale]
supportedLocales :: Maybe [Locale]
$sel:supportedLocales:BuiltinIntentMetadata' :: BuiltinIntentMetadata -> Maybe [Locale]
supportedLocales} -> Maybe [Locale]
supportedLocales) (\s :: BuiltinIntentMetadata
s@BuiltinIntentMetadata' {} Maybe [Locale]
a -> BuiltinIntentMetadata
s {$sel:supportedLocales:BuiltinIntentMetadata' :: Maybe [Locale]
supportedLocales = Maybe [Locale]
a} :: BuiltinIntentMetadata) ((Maybe [Locale] -> f (Maybe [Locale]))
 -> BuiltinIntentMetadata -> f BuiltinIntentMetadata)
-> ((Maybe [Locale] -> f (Maybe [Locale]))
    -> Maybe [Locale] -> f (Maybe [Locale]))
-> (Maybe [Locale] -> f (Maybe [Locale]))
-> BuiltinIntentMetadata
-> f BuiltinIntentMetadata
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 BuiltinIntentMetadata where
  parseJSON :: Value -> Parser BuiltinIntentMetadata
parseJSON =
    String
-> (Object -> Parser BuiltinIntentMetadata)
-> Value
-> Parser BuiltinIntentMetadata
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"BuiltinIntentMetadata"
      ( \Object
x ->
          Maybe Text -> Maybe [Locale] -> BuiltinIntentMetadata
BuiltinIntentMetadata'
            (Maybe Text -> Maybe [Locale] -> BuiltinIntentMetadata)
-> Parser (Maybe Text)
-> Parser (Maybe [Locale] -> BuiltinIntentMetadata)
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] -> BuiltinIntentMetadata)
-> Parser (Maybe [Locale]) -> Parser BuiltinIntentMetadata
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 BuiltinIntentMetadata

instance Prelude.NFData BuiltinIntentMetadata