module TD.Query.GetPreparedKeyboardButton
  (GetPreparedKeyboardButton(..)
  , defaultGetPreparedKeyboardButton
  ) 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 a keyboard button prepared by the bot for the user. The button will be of the type keyboardButtonTypeRequestUsers, keyboardButtonTypeRequestChat, or keyboardButtonTypeRequestManagedBot. Returns 'TD.Data.KeyboardButton.KeyboardButton'
data GetPreparedKeyboardButton
  = GetPreparedKeyboardButton
    { GetPreparedKeyboardButton -> Maybe Int
bot_user_id        :: Maybe Int    -- ^ Identifier of the bot that created the button
    , GetPreparedKeyboardButton -> Maybe Text
prepared_button_id :: Maybe T.Text -- ^ Identifier of the prepared button
    }
  deriving (GetPreparedKeyboardButton -> GetPreparedKeyboardButton -> Bool
(GetPreparedKeyboardButton -> GetPreparedKeyboardButton -> Bool)
-> (GetPreparedKeyboardButton -> GetPreparedKeyboardButton -> Bool)
-> Eq GetPreparedKeyboardButton
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetPreparedKeyboardButton -> GetPreparedKeyboardButton -> Bool
== :: GetPreparedKeyboardButton -> GetPreparedKeyboardButton -> Bool
$c/= :: GetPreparedKeyboardButton -> GetPreparedKeyboardButton -> Bool
/= :: GetPreparedKeyboardButton -> GetPreparedKeyboardButton -> Bool
Eq, Int -> GetPreparedKeyboardButton -> ShowS
[GetPreparedKeyboardButton] -> ShowS
GetPreparedKeyboardButton -> String
(Int -> GetPreparedKeyboardButton -> ShowS)
-> (GetPreparedKeyboardButton -> String)
-> ([GetPreparedKeyboardButton] -> ShowS)
-> Show GetPreparedKeyboardButton
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetPreparedKeyboardButton -> ShowS
showsPrec :: Int -> GetPreparedKeyboardButton -> ShowS
$cshow :: GetPreparedKeyboardButton -> String
show :: GetPreparedKeyboardButton -> String
$cshowList :: [GetPreparedKeyboardButton] -> ShowS
showList :: [GetPreparedKeyboardButton] -> ShowS
Show)

instance I.ShortShow GetPreparedKeyboardButton where
  shortShow :: GetPreparedKeyboardButton -> String
shortShow
    GetPreparedKeyboardButton
      { bot_user_id :: GetPreparedKeyboardButton -> Maybe Int
bot_user_id        = Maybe Int
bot_user_id_
      , prepared_button_id :: GetPreparedKeyboardButton -> Maybe Text
prepared_button_id = Maybe Text
prepared_button_id_
      }
        = String
"GetPreparedKeyboardButton"
          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
"prepared_button_id" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
prepared_button_id_
          ]

instance AT.ToJSON GetPreparedKeyboardButton where
  toJSON :: GetPreparedKeyboardButton -> Value
toJSON
    GetPreparedKeyboardButton
      { bot_user_id :: GetPreparedKeyboardButton -> Maybe Int
bot_user_id        = Maybe Int
bot_user_id_
      , prepared_button_id :: GetPreparedKeyboardButton -> Maybe Text
prepared_button_id = Maybe Text
prepared_button_id_
      }
        = [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
"getPreparedKeyboardButton"
          , 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
"prepared_button_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
prepared_button_id_
          ]

defaultGetPreparedKeyboardButton :: GetPreparedKeyboardButton
defaultGetPreparedKeyboardButton :: GetPreparedKeyboardButton
defaultGetPreparedKeyboardButton =
  GetPreparedKeyboardButton
    { bot_user_id :: Maybe Int
bot_user_id        = Maybe Int
forall a. Maybe a
Nothing
    , prepared_button_id :: Maybe Text
prepared_button_id = Maybe Text
forall a. Maybe a
Nothing
    }