module TD.Query.CheckEmailAddressVerificationCode
  (CheckEmailAddressVerificationCode(..)
  ) 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

-- | Checks the email address verification code for Telegram Passport. Returns 'TD.Data.Ok.Ok'
data CheckEmailAddressVerificationCode
  = CheckEmailAddressVerificationCode
    { CheckEmailAddressVerificationCode -> Maybe Text
code :: Maybe T.Text -- ^ Verification code to check
    }
  deriving (CheckEmailAddressVerificationCode
-> CheckEmailAddressVerificationCode -> Bool
(CheckEmailAddressVerificationCode
 -> CheckEmailAddressVerificationCode -> Bool)
-> (CheckEmailAddressVerificationCode
    -> CheckEmailAddressVerificationCode -> Bool)
-> Eq CheckEmailAddressVerificationCode
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CheckEmailAddressVerificationCode
-> CheckEmailAddressVerificationCode -> Bool
== :: CheckEmailAddressVerificationCode
-> CheckEmailAddressVerificationCode -> Bool
$c/= :: CheckEmailAddressVerificationCode
-> CheckEmailAddressVerificationCode -> Bool
/= :: CheckEmailAddressVerificationCode
-> CheckEmailAddressVerificationCode -> Bool
Eq, Int -> CheckEmailAddressVerificationCode -> ShowS
[CheckEmailAddressVerificationCode] -> ShowS
CheckEmailAddressVerificationCode -> String
(Int -> CheckEmailAddressVerificationCode -> ShowS)
-> (CheckEmailAddressVerificationCode -> String)
-> ([CheckEmailAddressVerificationCode] -> ShowS)
-> Show CheckEmailAddressVerificationCode
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CheckEmailAddressVerificationCode -> ShowS
showsPrec :: Int -> CheckEmailAddressVerificationCode -> ShowS
$cshow :: CheckEmailAddressVerificationCode -> String
show :: CheckEmailAddressVerificationCode -> String
$cshowList :: [CheckEmailAddressVerificationCode] -> ShowS
showList :: [CheckEmailAddressVerificationCode] -> ShowS
Show)

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

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