module TD.Query.GetWebAppPlaceholder
  (GetWebAppPlaceholder(..)
  ) where

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

-- | Returns a default placeholder for Web Apps of a bot; this is an offline request. Returns a 404 error if the placeholder isn't known. Returns 'TD.Data.Outline.Outline'
data GetWebAppPlaceholder
  = GetWebAppPlaceholder
    { GetWebAppPlaceholder -> Maybe Int
bot_user_id :: Maybe Int -- ^ Identifier of the target bot
    }
  deriving (GetWebAppPlaceholder -> GetWebAppPlaceholder -> Bool
(GetWebAppPlaceholder -> GetWebAppPlaceholder -> Bool)
-> (GetWebAppPlaceholder -> GetWebAppPlaceholder -> Bool)
-> Eq GetWebAppPlaceholder
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetWebAppPlaceholder -> GetWebAppPlaceholder -> Bool
== :: GetWebAppPlaceholder -> GetWebAppPlaceholder -> Bool
$c/= :: GetWebAppPlaceholder -> GetWebAppPlaceholder -> Bool
/= :: GetWebAppPlaceholder -> GetWebAppPlaceholder -> Bool
Eq, Int -> GetWebAppPlaceholder -> ShowS
[GetWebAppPlaceholder] -> ShowS
GetWebAppPlaceholder -> String
(Int -> GetWebAppPlaceholder -> ShowS)
-> (GetWebAppPlaceholder -> String)
-> ([GetWebAppPlaceholder] -> ShowS)
-> Show GetWebAppPlaceholder
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetWebAppPlaceholder -> ShowS
showsPrec :: Int -> GetWebAppPlaceholder -> ShowS
$cshow :: GetWebAppPlaceholder -> String
show :: GetWebAppPlaceholder -> String
$cshowList :: [GetWebAppPlaceholder] -> ShowS
showList :: [GetWebAppPlaceholder] -> ShowS
Show)

instance I.ShortShow GetWebAppPlaceholder where
  shortShow :: GetWebAppPlaceholder -> String
shortShow
    GetWebAppPlaceholder
      { bot_user_id :: GetWebAppPlaceholder -> Maybe Int
bot_user_id = Maybe Int
bot_user_id_
      }
        = String
"GetWebAppPlaceholder"
          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_
          ]

instance AT.ToJSON GetWebAppPlaceholder where
  toJSON :: GetWebAppPlaceholder -> Value
toJSON
    GetWebAppPlaceholder
      { bot_user_id :: GetWebAppPlaceholder -> Maybe Int
bot_user_id = Maybe Int
bot_user_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
"getWebAppPlaceholder"
          , 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_
          ]