module TD.Query.GetLanguagePackStrings
  (GetLanguagePackStrings(..)
  , defaultGetLanguagePackStrings
  ) where

import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
import qualified Data.Text as T

-- | Returns strings from a language pack in the current localization target by their keys. Can be called before authorization. Returns 'TD.Data.LanguagePackStrings.LanguagePackStrings'
data GetLanguagePackStrings
  = GetLanguagePackStrings
    { GetLanguagePackStrings -> Maybe Text
language_pack_id :: Maybe T.Text   -- ^ Language pack identifier of the strings to be returned
    , GetLanguagePackStrings -> Maybe [Text]
keys             :: Maybe [T.Text] -- ^ Language pack keys of the strings to be returned; leave empty to request all available strings
    }
  deriving (GetLanguagePackStrings -> GetLanguagePackStrings -> Bool
(GetLanguagePackStrings -> GetLanguagePackStrings -> Bool)
-> (GetLanguagePackStrings -> GetLanguagePackStrings -> Bool)
-> Eq GetLanguagePackStrings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetLanguagePackStrings -> GetLanguagePackStrings -> Bool
== :: GetLanguagePackStrings -> GetLanguagePackStrings -> Bool
$c/= :: GetLanguagePackStrings -> GetLanguagePackStrings -> Bool
/= :: GetLanguagePackStrings -> GetLanguagePackStrings -> Bool
Eq, Int -> GetLanguagePackStrings -> ShowS
[GetLanguagePackStrings] -> ShowS
GetLanguagePackStrings -> String
(Int -> GetLanguagePackStrings -> ShowS)
-> (GetLanguagePackStrings -> String)
-> ([GetLanguagePackStrings] -> ShowS)
-> Show GetLanguagePackStrings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetLanguagePackStrings -> ShowS
showsPrec :: Int -> GetLanguagePackStrings -> ShowS
$cshow :: GetLanguagePackStrings -> String
show :: GetLanguagePackStrings -> String
$cshowList :: [GetLanguagePackStrings] -> ShowS
showList :: [GetLanguagePackStrings] -> ShowS
Show)

instance I.ShortShow GetLanguagePackStrings where
  shortShow :: GetLanguagePackStrings -> String
shortShow
    GetLanguagePackStrings
      { language_pack_id :: GetLanguagePackStrings -> Maybe Text
language_pack_id = Maybe Text
language_pack_id_
      , keys :: GetLanguagePackStrings -> Maybe [Text]
keys             = Maybe [Text]
keys_
      }
        = String
"GetLanguagePackStrings"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"language_pack_id" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
language_pack_id_
          , String
"keys"             String -> Maybe [Text] -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe [Text]
keys_
          ]

instance AT.ToJSON GetLanguagePackStrings where
  toJSON :: GetLanguagePackStrings -> Value
toJSON
    GetLanguagePackStrings
      { language_pack_id :: GetLanguagePackStrings -> Maybe Text
language_pack_id = Maybe Text
language_pack_id_
      , keys :: GetLanguagePackStrings -> Maybe [Text]
keys             = Maybe [Text]
keys_
      }
        = [Pair] -> Value
A.object
          [ Key
"@type"            Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"getLanguagePackStrings"
          , Key
"language_pack_id" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
language_pack_id_
          , Key
"keys"             Key -> Maybe [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe [Text]
keys_
          ]

defaultGetLanguagePackStrings :: GetLanguagePackStrings
defaultGetLanguagePackStrings :: GetLanguagePackStrings
defaultGetLanguagePackStrings =
  GetLanguagePackStrings
    { language_pack_id :: Maybe Text
language_pack_id = Maybe Text
forall a. Maybe a
Nothing
    , keys :: Maybe [Text]
keys             = Maybe [Text]
forall a. Maybe a
Nothing
    }