module TD.Query.ResetAuthenticationEmailAddress
  (ResetAuthenticationEmailAddress(..)
  ) where

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

-- | Resets the login email address. May return an error with a message "TASK_ALREADY_EXISTS" if reset is still pending. Works only when the current authorization state is authorizationStateWaitEmailCode and authorization_state.can_reset_email_address == true. Returns 'TD.Data.Ok.Ok'
data ResetAuthenticationEmailAddress
  = ResetAuthenticationEmailAddress
  deriving (ResetAuthenticationEmailAddress
-> ResetAuthenticationEmailAddress -> Bool
(ResetAuthenticationEmailAddress
 -> ResetAuthenticationEmailAddress -> Bool)
-> (ResetAuthenticationEmailAddress
    -> ResetAuthenticationEmailAddress -> Bool)
-> Eq ResetAuthenticationEmailAddress
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ResetAuthenticationEmailAddress
-> ResetAuthenticationEmailAddress -> Bool
== :: ResetAuthenticationEmailAddress
-> ResetAuthenticationEmailAddress -> Bool
$c/= :: ResetAuthenticationEmailAddress
-> ResetAuthenticationEmailAddress -> Bool
/= :: ResetAuthenticationEmailAddress
-> ResetAuthenticationEmailAddress -> Bool
Eq, Int -> ResetAuthenticationEmailAddress -> ShowS
[ResetAuthenticationEmailAddress] -> ShowS
ResetAuthenticationEmailAddress -> String
(Int -> ResetAuthenticationEmailAddress -> ShowS)
-> (ResetAuthenticationEmailAddress -> String)
-> ([ResetAuthenticationEmailAddress] -> ShowS)
-> Show ResetAuthenticationEmailAddress
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ResetAuthenticationEmailAddress -> ShowS
showsPrec :: Int -> ResetAuthenticationEmailAddress -> ShowS
$cshow :: ResetAuthenticationEmailAddress -> String
show :: ResetAuthenticationEmailAddress -> String
$cshowList :: [ResetAuthenticationEmailAddress] -> ShowS
showList :: [ResetAuthenticationEmailAddress] -> ShowS
Show)

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

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