module TD.Query.GetCurrentState
  (GetCurrentState(..)
  ) where

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

-- | Returns all updates needed to restore current TDLib state, i.e. all actual updateAuthorizationState/updateUser/updateNewChat and others. This is especially useful if TDLib is run in a separate process. Can be called before initialization. Returns 'TD.Data.Updates.Updates'
data GetCurrentState
  = GetCurrentState
  deriving (GetCurrentState -> GetCurrentState -> Bool
(GetCurrentState -> GetCurrentState -> Bool)
-> (GetCurrentState -> GetCurrentState -> Bool)
-> Eq GetCurrentState
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetCurrentState -> GetCurrentState -> Bool
== :: GetCurrentState -> GetCurrentState -> Bool
$c/= :: GetCurrentState -> GetCurrentState -> Bool
/= :: GetCurrentState -> GetCurrentState -> Bool
Eq, Int -> GetCurrentState -> ShowS
[GetCurrentState] -> ShowS
GetCurrentState -> String
(Int -> GetCurrentState -> ShowS)
-> (GetCurrentState -> String)
-> ([GetCurrentState] -> ShowS)
-> Show GetCurrentState
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetCurrentState -> ShowS
showsPrec :: Int -> GetCurrentState -> ShowS
$cshow :: GetCurrentState -> String
show :: GetCurrentState -> String
$cshowList :: [GetCurrentState] -> ShowS
showList :: [GetCurrentState] -> ShowS
Show)

instance I.ShortShow GetCurrentState where
  shortShow :: GetCurrentState -> String
shortShow
    GetCurrentState
GetCurrentState
        = String
"GetCurrentState"

instance AT.ToJSON GetCurrentState where
  toJSON :: GetCurrentState -> Value
toJSON
    GetCurrentState
GetCurrentState
        = [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
"getCurrentState"
          ]