module TD.Query.GetTonConnectSessionPendingRequests
  (GetTonConnectSessionPendingRequests(..)
  ) where

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

-- | Returns pending requests in a TON Connect session. Returns 'TD.Data.TonConnectRequests.TonConnectRequests'
data GetTonConnectSessionPendingRequests
  = GetTonConnectSessionPendingRequests
    { GetTonConnectSessionPendingRequests -> Maybe Int
session_id :: Maybe Int -- ^ Unique identifier of the session
    }
  deriving (GetTonConnectSessionPendingRequests
-> GetTonConnectSessionPendingRequests -> Bool
(GetTonConnectSessionPendingRequests
 -> GetTonConnectSessionPendingRequests -> Bool)
-> (GetTonConnectSessionPendingRequests
    -> GetTonConnectSessionPendingRequests -> Bool)
-> Eq GetTonConnectSessionPendingRequests
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetTonConnectSessionPendingRequests
-> GetTonConnectSessionPendingRequests -> Bool
== :: GetTonConnectSessionPendingRequests
-> GetTonConnectSessionPendingRequests -> Bool
$c/= :: GetTonConnectSessionPendingRequests
-> GetTonConnectSessionPendingRequests -> Bool
/= :: GetTonConnectSessionPendingRequests
-> GetTonConnectSessionPendingRequests -> Bool
Eq, Int -> GetTonConnectSessionPendingRequests -> ShowS
[GetTonConnectSessionPendingRequests] -> ShowS
GetTonConnectSessionPendingRequests -> String
(Int -> GetTonConnectSessionPendingRequests -> ShowS)
-> (GetTonConnectSessionPendingRequests -> String)
-> ([GetTonConnectSessionPendingRequests] -> ShowS)
-> Show GetTonConnectSessionPendingRequests
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetTonConnectSessionPendingRequests -> ShowS
showsPrec :: Int -> GetTonConnectSessionPendingRequests -> ShowS
$cshow :: GetTonConnectSessionPendingRequests -> String
show :: GetTonConnectSessionPendingRequests -> String
$cshowList :: [GetTonConnectSessionPendingRequests] -> ShowS
showList :: [GetTonConnectSessionPendingRequests] -> ShowS
Show)

instance I.ShortShow GetTonConnectSessionPendingRequests where
  shortShow :: GetTonConnectSessionPendingRequests -> String
shortShow
    GetTonConnectSessionPendingRequests
      { session_id :: GetTonConnectSessionPendingRequests -> Maybe Int
session_id = Maybe Int
session_id_
      }
        = String
"GetTonConnectSessionPendingRequests"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"session_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
session_id_
          ]

instance AT.ToJSON GetTonConnectSessionPendingRequests where
  toJSON :: GetTonConnectSessionPendingRequests -> Value
toJSON
    GetTonConnectSessionPendingRequests
      { session_id :: GetTonConnectSessionPendingRequests -> Maybe Int
session_id = Maybe Int
session_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
"getTonConnectSessionPendingRequests"
          , Key
"session_id" Key -> Maybe Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= (Int -> Value) -> Maybe Int -> Maybe Value
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Int -> Value
I.writeInt64  Maybe Int
session_id_
          ]