module TD.Query.GetRecoveryEmailAddress
  (GetRecoveryEmailAddress(..)
  ) 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 a 2-step verification recovery email address that was previously set up. This method can be used to verify a password provided by the user. Returns 'TD.Data.RecoveryEmailAddress.RecoveryEmailAddress'
data GetRecoveryEmailAddress
  = GetRecoveryEmailAddress
    { GetRecoveryEmailAddress -> Maybe Text
password :: Maybe T.Text -- ^ The 2-step verification password for the current user
    }
  deriving (GetRecoveryEmailAddress -> GetRecoveryEmailAddress -> Bool
(GetRecoveryEmailAddress -> GetRecoveryEmailAddress -> Bool)
-> (GetRecoveryEmailAddress -> GetRecoveryEmailAddress -> Bool)
-> Eq GetRecoveryEmailAddress
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetRecoveryEmailAddress -> GetRecoveryEmailAddress -> Bool
== :: GetRecoveryEmailAddress -> GetRecoveryEmailAddress -> Bool
$c/= :: GetRecoveryEmailAddress -> GetRecoveryEmailAddress -> Bool
/= :: GetRecoveryEmailAddress -> GetRecoveryEmailAddress -> Bool
Eq, Int -> GetRecoveryEmailAddress -> ShowS
[GetRecoveryEmailAddress] -> ShowS
GetRecoveryEmailAddress -> String
(Int -> GetRecoveryEmailAddress -> ShowS)
-> (GetRecoveryEmailAddress -> String)
-> ([GetRecoveryEmailAddress] -> ShowS)
-> Show GetRecoveryEmailAddress
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetRecoveryEmailAddress -> ShowS
showsPrec :: Int -> GetRecoveryEmailAddress -> ShowS
$cshow :: GetRecoveryEmailAddress -> String
show :: GetRecoveryEmailAddress -> String
$cshowList :: [GetRecoveryEmailAddress] -> ShowS
showList :: [GetRecoveryEmailAddress] -> ShowS
Show)

instance I.ShortShow GetRecoveryEmailAddress where
  shortShow :: GetRecoveryEmailAddress -> String
shortShow
    GetRecoveryEmailAddress
      { password :: GetRecoveryEmailAddress -> Maybe Text
password = Maybe Text
password_
      }
        = String
"GetRecoveryEmailAddress"
          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 GetRecoveryEmailAddress where
  toJSON :: GetRecoveryEmailAddress -> Value
toJSON
    GetRecoveryEmailAddress
      { password :: GetRecoveryEmailAddress -> 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
"getRecoveryEmailAddress"
          , 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_
          ]