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

-- | Provides the bot locale parameters required for exporting a bot locale.
--
-- /See:/ 'newBotLocaleExportSpecification' smart constructor.
data BotLocaleExportSpecification = BotLocaleExportSpecification'
  { -- | The identifier of the bot to create the locale for.
    BotLocaleExportSpecification -> Text
botId :: Prelude.Text,
    -- | The version of the bot to export.
    BotLocaleExportSpecification -> Text
botVersion :: Prelude.Text,
    -- | The identifier of the language and locale to export. The string must
    -- match one of the locales in the bot.
    BotLocaleExportSpecification -> Text
localeId :: Prelude.Text
  }
  deriving (BotLocaleExportSpecification
-> BotLocaleExportSpecification -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BotLocaleExportSpecification
-> BotLocaleExportSpecification -> Bool
$c/= :: BotLocaleExportSpecification
-> BotLocaleExportSpecification -> Bool
== :: BotLocaleExportSpecification
-> BotLocaleExportSpecification -> Bool
$c== :: BotLocaleExportSpecification
-> BotLocaleExportSpecification -> Bool
Prelude.Eq, ReadPrec [BotLocaleExportSpecification]
ReadPrec BotLocaleExportSpecification
Int -> ReadS BotLocaleExportSpecification
ReadS [BotLocaleExportSpecification]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BotLocaleExportSpecification]
$creadListPrec :: ReadPrec [BotLocaleExportSpecification]
readPrec :: ReadPrec BotLocaleExportSpecification
$creadPrec :: ReadPrec BotLocaleExportSpecification
readList :: ReadS [BotLocaleExportSpecification]
$creadList :: ReadS [BotLocaleExportSpecification]
readsPrec :: Int -> ReadS BotLocaleExportSpecification
$creadsPrec :: Int -> ReadS BotLocaleExportSpecification
Prelude.Read, Int -> BotLocaleExportSpecification -> ShowS
[BotLocaleExportSpecification] -> ShowS
BotLocaleExportSpecification -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BotLocaleExportSpecification] -> ShowS
$cshowList :: [BotLocaleExportSpecification] -> ShowS
show :: BotLocaleExportSpecification -> String
$cshow :: BotLocaleExportSpecification -> String
showsPrec :: Int -> BotLocaleExportSpecification -> ShowS
$cshowsPrec :: Int -> BotLocaleExportSpecification -> ShowS
Prelude.Show, forall x.
Rep BotLocaleExportSpecification x -> BotLocaleExportSpecification
forall x.
BotLocaleExportSpecification -> Rep BotLocaleExportSpecification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BotLocaleExportSpecification x -> BotLocaleExportSpecification
$cfrom :: forall x.
BotLocaleExportSpecification -> Rep BotLocaleExportSpecification x
Prelude.Generic)

-- |
-- Create a value of 'BotLocaleExportSpecification' 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:
--
-- 'botId', 'botLocaleExportSpecification_botId' - The identifier of the bot to create the locale for.
--
-- 'botVersion', 'botLocaleExportSpecification_botVersion' - The version of the bot to export.
--
-- 'localeId', 'botLocaleExportSpecification_localeId' - The identifier of the language and locale to export. The string must
-- match one of the locales in the bot.
newBotLocaleExportSpecification ::
  -- | 'botId'
  Prelude.Text ->
  -- | 'botVersion'
  Prelude.Text ->
  -- | 'localeId'
  Prelude.Text ->
  BotLocaleExportSpecification
newBotLocaleExportSpecification :: Text -> Text -> Text -> BotLocaleExportSpecification
newBotLocaleExportSpecification
  Text
pBotId_
  Text
pBotVersion_
  Text
pLocaleId_ =
    BotLocaleExportSpecification'
      { $sel:botId:BotLocaleExportSpecification' :: Text
botId = Text
pBotId_,
        $sel:botVersion:BotLocaleExportSpecification' :: Text
botVersion = Text
pBotVersion_,
        $sel:localeId:BotLocaleExportSpecification' :: Text
localeId = Text
pLocaleId_
      }

-- | The identifier of the bot to create the locale for.
botLocaleExportSpecification_botId :: Lens.Lens' BotLocaleExportSpecification Prelude.Text
botLocaleExportSpecification_botId :: Lens' BotLocaleExportSpecification Text
botLocaleExportSpecification_botId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BotLocaleExportSpecification' {Text
botId :: Text
$sel:botId:BotLocaleExportSpecification' :: BotLocaleExportSpecification -> Text
botId} -> Text
botId) (\s :: BotLocaleExportSpecification
s@BotLocaleExportSpecification' {} Text
a -> BotLocaleExportSpecification
s {$sel:botId:BotLocaleExportSpecification' :: Text
botId = Text
a} :: BotLocaleExportSpecification)

-- | The version of the bot to export.
botLocaleExportSpecification_botVersion :: Lens.Lens' BotLocaleExportSpecification Prelude.Text
botLocaleExportSpecification_botVersion :: Lens' BotLocaleExportSpecification Text
botLocaleExportSpecification_botVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BotLocaleExportSpecification' {Text
botVersion :: Text
$sel:botVersion:BotLocaleExportSpecification' :: BotLocaleExportSpecification -> Text
botVersion} -> Text
botVersion) (\s :: BotLocaleExportSpecification
s@BotLocaleExportSpecification' {} Text
a -> BotLocaleExportSpecification
s {$sel:botVersion:BotLocaleExportSpecification' :: Text
botVersion = Text
a} :: BotLocaleExportSpecification)

-- | The identifier of the language and locale to export. The string must
-- match one of the locales in the bot.
botLocaleExportSpecification_localeId :: Lens.Lens' BotLocaleExportSpecification Prelude.Text
botLocaleExportSpecification_localeId :: Lens' BotLocaleExportSpecification Text
botLocaleExportSpecification_localeId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BotLocaleExportSpecification' {Text
localeId :: Text
$sel:localeId:BotLocaleExportSpecification' :: BotLocaleExportSpecification -> Text
localeId} -> Text
localeId) (\s :: BotLocaleExportSpecification
s@BotLocaleExportSpecification' {} Text
a -> BotLocaleExportSpecification
s {$sel:localeId:BotLocaleExportSpecification' :: Text
localeId = Text
a} :: BotLocaleExportSpecification)

instance Data.FromJSON BotLocaleExportSpecification where
  parseJSON :: Value -> Parser BotLocaleExportSpecification
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"BotLocaleExportSpecification"
      ( \Object
x ->
          Text -> Text -> Text -> BotLocaleExportSpecification
BotLocaleExportSpecification'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"botId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"botVersion")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"localeId")
      )

instance
  Prelude.Hashable
    BotLocaleExportSpecification
  where
  hashWithSalt :: Int -> BotLocaleExportSpecification -> Int
hashWithSalt Int
_salt BotLocaleExportSpecification' {Text
localeId :: Text
botVersion :: Text
botId :: Text
$sel:localeId:BotLocaleExportSpecification' :: BotLocaleExportSpecification -> Text
$sel:botVersion:BotLocaleExportSpecification' :: BotLocaleExportSpecification -> Text
$sel:botId:BotLocaleExportSpecification' :: BotLocaleExportSpecification -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
botId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
botVersion
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
localeId

instance Prelude.NFData BotLocaleExportSpecification where
  rnf :: BotLocaleExportSpecification -> ()
rnf BotLocaleExportSpecification' {Text
localeId :: Text
botVersion :: Text
botId :: Text
$sel:localeId:BotLocaleExportSpecification' :: BotLocaleExportSpecification -> Text
$sel:botVersion:BotLocaleExportSpecification' :: BotLocaleExportSpecification -> Text
$sel:botId:BotLocaleExportSpecification' :: BotLocaleExportSpecification -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
botId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
botVersion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
localeId

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