module TD.Query.GetAllPassportElements
  (GetAllPassportElements(..)
  ) 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 all available Telegram Passport elements. Returns 'TD.Data.PassportElements.PassportElements'
data GetAllPassportElements
  = GetAllPassportElements
    { GetAllPassportElements -> Maybe Text
password :: Maybe T.Text -- ^ The 2-step verification password of the current user
    }
  deriving (GetAllPassportElements -> GetAllPassportElements -> Bool
(GetAllPassportElements -> GetAllPassportElements -> Bool)
-> (GetAllPassportElements -> GetAllPassportElements -> Bool)
-> Eq GetAllPassportElements
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetAllPassportElements -> GetAllPassportElements -> Bool
== :: GetAllPassportElements -> GetAllPassportElements -> Bool
$c/= :: GetAllPassportElements -> GetAllPassportElements -> Bool
/= :: GetAllPassportElements -> GetAllPassportElements -> Bool
Eq, Int -> GetAllPassportElements -> ShowS
[GetAllPassportElements] -> ShowS
GetAllPassportElements -> String
(Int -> GetAllPassportElements -> ShowS)
-> (GetAllPassportElements -> String)
-> ([GetAllPassportElements] -> ShowS)
-> Show GetAllPassportElements
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetAllPassportElements -> ShowS
showsPrec :: Int -> GetAllPassportElements -> ShowS
$cshow :: GetAllPassportElements -> String
show :: GetAllPassportElements -> String
$cshowList :: [GetAllPassportElements] -> ShowS
showList :: [GetAllPassportElements] -> ShowS
Show)

instance I.ShortShow GetAllPassportElements where
  shortShow :: GetAllPassportElements -> String
shortShow
    GetAllPassportElements
      { password :: GetAllPassportElements -> Maybe Text
password = Maybe Text
password_
      }
        = String
"GetAllPassportElements"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"password" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
password_
          ]

instance AT.ToJSON GetAllPassportElements where
  toJSON :: GetAllPassportElements -> Value
toJSON
    GetAllPassportElements
      { password :: GetAllPassportElements -> Maybe Text
password = Maybe Text
password_
      }
        = [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
"getAllPassportElements"
          , Key
"password" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
password_
          ]