module TD.Query.GetBotMediaPreviewInfo
  (GetBotMediaPreviewInfo(..)
  , defaultGetBotMediaPreviewInfo
  ) 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 the list of media previews for the given language and the list of languages for which the bot has dedicated previews. Returns 'TD.Data.BotMediaPreviewInfo.BotMediaPreviewInfo'
data GetBotMediaPreviewInfo
  = GetBotMediaPreviewInfo
    { GetBotMediaPreviewInfo -> Maybe Int
bot_user_id   :: Maybe Int    -- ^ Identifier of the target bot. The bot must be owned and must have the main Web App
    , GetBotMediaPreviewInfo -> Maybe Text
language_code :: Maybe T.Text -- ^ A two-letter ISO 639-1 language code for which to get previews. If empty, then default previews are returned
    }
  deriving (GetBotMediaPreviewInfo -> GetBotMediaPreviewInfo -> Bool
(GetBotMediaPreviewInfo -> GetBotMediaPreviewInfo -> Bool)
-> (GetBotMediaPreviewInfo -> GetBotMediaPreviewInfo -> Bool)
-> Eq GetBotMediaPreviewInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetBotMediaPreviewInfo -> GetBotMediaPreviewInfo -> Bool
== :: GetBotMediaPreviewInfo -> GetBotMediaPreviewInfo -> Bool
$c/= :: GetBotMediaPreviewInfo -> GetBotMediaPreviewInfo -> Bool
/= :: GetBotMediaPreviewInfo -> GetBotMediaPreviewInfo -> Bool
Eq, Int -> GetBotMediaPreviewInfo -> ShowS
[GetBotMediaPreviewInfo] -> ShowS
GetBotMediaPreviewInfo -> String
(Int -> GetBotMediaPreviewInfo -> ShowS)
-> (GetBotMediaPreviewInfo -> String)
-> ([GetBotMediaPreviewInfo] -> ShowS)
-> Show GetBotMediaPreviewInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetBotMediaPreviewInfo -> ShowS
showsPrec :: Int -> GetBotMediaPreviewInfo -> ShowS
$cshow :: GetBotMediaPreviewInfo -> String
show :: GetBotMediaPreviewInfo -> String
$cshowList :: [GetBotMediaPreviewInfo] -> ShowS
showList :: [GetBotMediaPreviewInfo] -> ShowS
Show)

instance I.ShortShow GetBotMediaPreviewInfo where
  shortShow :: GetBotMediaPreviewInfo -> String
shortShow
    GetBotMediaPreviewInfo
      { bot_user_id :: GetBotMediaPreviewInfo -> Maybe Int
bot_user_id   = Maybe Int
bot_user_id_
      , language_code :: GetBotMediaPreviewInfo -> Maybe Text
language_code = Maybe Text
language_code_
      }
        = String
"GetBotMediaPreviewInfo"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"bot_user_id"   String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
bot_user_id_
          , String
"language_code" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
language_code_
          ]

instance AT.ToJSON GetBotMediaPreviewInfo where
  toJSON :: GetBotMediaPreviewInfo -> Value
toJSON
    GetBotMediaPreviewInfo
      { bot_user_id :: GetBotMediaPreviewInfo -> Maybe Int
bot_user_id   = Maybe Int
bot_user_id_
      , language_code :: GetBotMediaPreviewInfo -> Maybe Text
language_code = Maybe Text
language_code_
      }
        = [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
"getBotMediaPreviewInfo"
          , Key
"bot_user_id"   Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
bot_user_id_
          , Key
"language_code" 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_code_
          ]

defaultGetBotMediaPreviewInfo :: GetBotMediaPreviewInfo
defaultGetBotMediaPreviewInfo :: GetBotMediaPreviewInfo
defaultGetBotMediaPreviewInfo =
  GetBotMediaPreviewInfo
    { bot_user_id :: Maybe Int
bot_user_id   = Maybe Int
forall a. Maybe a
Nothing
    , language_code :: Maybe Text
language_code = Maybe Text
forall a. Maybe a
Nothing
    }