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

-- | Sends a Firebase Authentication SMS to the phone number of the user. Works only when the current authorization state is authorizationStateWaitCode and the server returned a code of the type authenticationCodeTypeFirebaseAndroid or authenticationCodeTypeFirebaseIos. Returns 'TD.Data.Ok.Ok'
data SendAuthenticationFirebaseSms
  = SendAuthenticationFirebaseSms
    { SendAuthenticationFirebaseSms -> Maybe Text
token :: Maybe T.Text -- ^ Play Integrity API or SafetyNet Attestation API token for the Android application, or secret from a push notification for the iOS application
    }
  deriving (SendAuthenticationFirebaseSms
-> SendAuthenticationFirebaseSms -> Bool
(SendAuthenticationFirebaseSms
 -> SendAuthenticationFirebaseSms -> Bool)
-> (SendAuthenticationFirebaseSms
    -> SendAuthenticationFirebaseSms -> Bool)
-> Eq SendAuthenticationFirebaseSms
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SendAuthenticationFirebaseSms
-> SendAuthenticationFirebaseSms -> Bool
== :: SendAuthenticationFirebaseSms
-> SendAuthenticationFirebaseSms -> Bool
$c/= :: SendAuthenticationFirebaseSms
-> SendAuthenticationFirebaseSms -> Bool
/= :: SendAuthenticationFirebaseSms
-> SendAuthenticationFirebaseSms -> Bool
Eq, Int -> SendAuthenticationFirebaseSms -> ShowS
[SendAuthenticationFirebaseSms] -> ShowS
SendAuthenticationFirebaseSms -> String
(Int -> SendAuthenticationFirebaseSms -> ShowS)
-> (SendAuthenticationFirebaseSms -> String)
-> ([SendAuthenticationFirebaseSms] -> ShowS)
-> Show SendAuthenticationFirebaseSms
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SendAuthenticationFirebaseSms -> ShowS
showsPrec :: Int -> SendAuthenticationFirebaseSms -> ShowS
$cshow :: SendAuthenticationFirebaseSms -> String
show :: SendAuthenticationFirebaseSms -> String
$cshowList :: [SendAuthenticationFirebaseSms] -> ShowS
showList :: [SendAuthenticationFirebaseSms] -> ShowS
Show)

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

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