module TD.Query.GetBotInfoDescription
  (GetBotInfoDescription(..)
  , defaultGetBotInfoDescription
  ) 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 text shown in the chat with a bot if the chat is empty in the given language. Can be called only if userTypeBot.can_be_edited == true. Returns 'TD.Data.Text.Text'
data GetBotInfoDescription
  = GetBotInfoDescription
    { GetBotInfoDescription -> Maybe Int
bot_user_id   :: Maybe Int    -- ^ Identifier of the target bot
    , GetBotInfoDescription -> Maybe Text
language_code :: Maybe T.Text -- ^ A two-letter ISO 639-1 language code or an empty string
    }
  deriving (GetBotInfoDescription -> GetBotInfoDescription -> Bool
(GetBotInfoDescription -> GetBotInfoDescription -> Bool)
-> (GetBotInfoDescription -> GetBotInfoDescription -> Bool)
-> Eq GetBotInfoDescription
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetBotInfoDescription -> GetBotInfoDescription -> Bool
== :: GetBotInfoDescription -> GetBotInfoDescription -> Bool
$c/= :: GetBotInfoDescription -> GetBotInfoDescription -> Bool
/= :: GetBotInfoDescription -> GetBotInfoDescription -> Bool
Eq, Int -> GetBotInfoDescription -> ShowS
[GetBotInfoDescription] -> ShowS
GetBotInfoDescription -> String
(Int -> GetBotInfoDescription -> ShowS)
-> (GetBotInfoDescription -> String)
-> ([GetBotInfoDescription] -> ShowS)
-> Show GetBotInfoDescription
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetBotInfoDescription -> ShowS
showsPrec :: Int -> GetBotInfoDescription -> ShowS
$cshow :: GetBotInfoDescription -> String
show :: GetBotInfoDescription -> String
$cshowList :: [GetBotInfoDescription] -> ShowS
showList :: [GetBotInfoDescription] -> ShowS
Show)

instance I.ShortShow GetBotInfoDescription where
  shortShow :: GetBotInfoDescription -> String
shortShow
    GetBotInfoDescription
      { bot_user_id :: GetBotInfoDescription -> Maybe Int
bot_user_id   = Maybe Int
bot_user_id_
      , language_code :: GetBotInfoDescription -> Maybe Text
language_code = Maybe Text
language_code_
      }
        = String
"GetBotInfoDescription"
          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 GetBotInfoDescription where
  toJSON :: GetBotInfoDescription -> Value
toJSON
    GetBotInfoDescription
      { bot_user_id :: GetBotInfoDescription -> Maybe Int
bot_user_id   = Maybe Int
bot_user_id_
      , language_code :: GetBotInfoDescription -> 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
"getBotInfoDescription"
          , 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_
          ]

defaultGetBotInfoDescription :: GetBotInfoDescription
defaultGetBotInfoDescription :: GetBotInfoDescription
defaultGetBotInfoDescription =
  GetBotInfoDescription
    { 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
    }