module TD.Data.AuthenticationCodeType
  (AuthenticationCodeType(..)) 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
import qualified TD.Data.FirebaseDeviceVerificationParameters as FirebaseDeviceVerificationParameters

-- | Provides information about the method by which an authentication code is delivered to the user
data AuthenticationCodeType
  = AuthenticationCodeTypeTelegramMessage -- ^ A digit-only authentication code is delivered via a private Telegram message, which can be viewed from another active session
    { AuthenticationCodeType -> Maybe Int
_length :: Maybe Int -- ^ Length of the code
    }
  | AuthenticationCodeTypeSms -- ^ A digit-only authentication code is delivered via an SMS message to the specified phone number; non-official applications may not receive this type of code
    { _length :: Maybe Int -- ^ Length of the code
    }
  | AuthenticationCodeTypeSmsWord -- ^ An authentication code is a word delivered via an SMS message to the specified phone number; non-official applications may not receive this type of code
    { AuthenticationCodeType -> Maybe Text
first_letter :: Maybe T.Text -- ^ The first letters of the word if known
    }
  | AuthenticationCodeTypeSmsPhrase -- ^ An authentication code is a phrase from multiple words delivered via an SMS message to the specified phone number; non-official applications may not receive this type of code
    { AuthenticationCodeType -> Maybe Text
first_word :: Maybe T.Text -- ^ The first word of the phrase if known
    }
  | AuthenticationCodeTypeCall -- ^ A digit-only authentication code is delivered via a phone call to the specified phone number
    { _length :: Maybe Int -- ^ Length of the code
    }
  | AuthenticationCodeTypeFlashCall -- ^ An authentication code is delivered by an immediately canceled call to the specified phone number. The phone number that calls is the code that must be entered automatically
    { AuthenticationCodeType -> Maybe Text
pattern :: Maybe T.Text -- ^ Pattern of the phone number from which the call will be made
    }
  | AuthenticationCodeTypeMissedCall -- ^ An authentication code is delivered by an immediately canceled call to the specified phone number. The last digits of the phone number that calls are the code that must be entered manually by the user
    { AuthenticationCodeType -> Maybe Text
phone_number_prefix :: Maybe T.Text -- ^ Prefix of the phone number from which the call will be made
    , _length             :: Maybe Int    -- ^ Number of digits in the code, excluding the prefix
    }
  | AuthenticationCodeTypeFragment -- ^ A digit-only authentication code is delivered to https://fragment.com. The user must be logged in there via a wallet owning the phone number's NFT
    { AuthenticationCodeType -> Maybe Text
url     :: Maybe T.Text -- ^ URL to open to receive the code
    , _length :: Maybe Int    -- ^ Length of the code
    }
  | AuthenticationCodeTypeFirebaseAndroid -- ^ A digit-only authentication code is delivered via Firebase Authentication to the official Android application
    { AuthenticationCodeType
-> Maybe FirebaseDeviceVerificationParameters
device_verification_parameters :: Maybe FirebaseDeviceVerificationParameters.FirebaseDeviceVerificationParameters -- ^ Parameters to be used for device verification
    , _length                        :: Maybe Int                                                                       -- ^ Length of the code
    }
  | AuthenticationCodeTypeFirebaseIos -- ^ A digit-only authentication code is delivered via Firebase Authentication to the official iOS application
    { AuthenticationCodeType -> Maybe Text
receipt      :: Maybe T.Text -- ^ Receipt of successful application token validation to compare with receipt from push notification
    , AuthenticationCodeType -> Maybe Int
push_timeout :: Maybe Int    -- ^ Time after the next authentication method is expected to be used if verification push notification isn't received, in seconds
    , _length      :: Maybe Int    -- ^ Length of the code
    }
  deriving (AuthenticationCodeType -> AuthenticationCodeType -> Bool
(AuthenticationCodeType -> AuthenticationCodeType -> Bool)
-> (AuthenticationCodeType -> AuthenticationCodeType -> Bool)
-> Eq AuthenticationCodeType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: AuthenticationCodeType -> AuthenticationCodeType -> Bool
== :: AuthenticationCodeType -> AuthenticationCodeType -> Bool
$c/= :: AuthenticationCodeType -> AuthenticationCodeType -> Bool
/= :: AuthenticationCodeType -> AuthenticationCodeType -> Bool
Eq, Int -> AuthenticationCodeType -> ShowS
[AuthenticationCodeType] -> ShowS
AuthenticationCodeType -> String
(Int -> AuthenticationCodeType -> ShowS)
-> (AuthenticationCodeType -> String)
-> ([AuthenticationCodeType] -> ShowS)
-> Show AuthenticationCodeType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> AuthenticationCodeType -> ShowS
showsPrec :: Int -> AuthenticationCodeType -> ShowS
$cshow :: AuthenticationCodeType -> String
show :: AuthenticationCodeType -> String
$cshowList :: [AuthenticationCodeType] -> ShowS
showList :: [AuthenticationCodeType] -> ShowS
Show)

instance I.ShortShow AuthenticationCodeType where
  shortShow :: AuthenticationCodeType -> String
shortShow AuthenticationCodeTypeTelegramMessage
    { _length :: AuthenticationCodeType -> Maybe Int
_length = Maybe Int
_length_
    }
      = String
"AuthenticationCodeTypeTelegramMessage"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"_length" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
_length_
        ]
  shortShow AuthenticationCodeTypeSms
    { _length :: AuthenticationCodeType -> Maybe Int
_length = Maybe Int
_length_
    }
      = String
"AuthenticationCodeTypeSms"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"_length" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
_length_
        ]
  shortShow AuthenticationCodeTypeSmsWord
    { first_letter :: AuthenticationCodeType -> Maybe Text
first_letter = Maybe Text
first_letter_
    }
      = String
"AuthenticationCodeTypeSmsWord"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"first_letter" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
first_letter_
        ]
  shortShow AuthenticationCodeTypeSmsPhrase
    { first_word :: AuthenticationCodeType -> Maybe Text
first_word = Maybe Text
first_word_
    }
      = String
"AuthenticationCodeTypeSmsPhrase"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"first_word" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
first_word_
        ]
  shortShow AuthenticationCodeTypeCall
    { _length :: AuthenticationCodeType -> Maybe Int
_length = Maybe Int
_length_
    }
      = String
"AuthenticationCodeTypeCall"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"_length" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
_length_
        ]
  shortShow AuthenticationCodeTypeFlashCall
    { pattern :: AuthenticationCodeType -> Maybe Text
pattern = Maybe Text
pattern_
    }
      = String
"AuthenticationCodeTypeFlashCall"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"pattern" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
pattern_
        ]
  shortShow AuthenticationCodeTypeMissedCall
    { phone_number_prefix :: AuthenticationCodeType -> Maybe Text
phone_number_prefix = Maybe Text
phone_number_prefix_
    , _length :: AuthenticationCodeType -> Maybe Int
_length             = Maybe Int
_length_
    }
      = String
"AuthenticationCodeTypeMissedCall"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"phone_number_prefix" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
phone_number_prefix_
        , String
"_length"             String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
_length_
        ]
  shortShow AuthenticationCodeTypeFragment
    { url :: AuthenticationCodeType -> Maybe Text
url     = Maybe Text
url_
    , _length :: AuthenticationCodeType -> Maybe Int
_length = Maybe Int
_length_
    }
      = String
"AuthenticationCodeTypeFragment"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"url"     String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
url_
        , String
"_length" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
_length_
        ]
  shortShow AuthenticationCodeTypeFirebaseAndroid
    { device_verification_parameters :: AuthenticationCodeType
-> Maybe FirebaseDeviceVerificationParameters
device_verification_parameters = Maybe FirebaseDeviceVerificationParameters
device_verification_parameters_
    , _length :: AuthenticationCodeType -> Maybe Int
_length                        = Maybe Int
_length_
    }
      = String
"AuthenticationCodeTypeFirebaseAndroid"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"device_verification_parameters" String -> Maybe FirebaseDeviceVerificationParameters -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe FirebaseDeviceVerificationParameters
device_verification_parameters_
        , String
"_length"                        String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
_length_
        ]
  shortShow AuthenticationCodeTypeFirebaseIos
    { receipt :: AuthenticationCodeType -> Maybe Text
receipt      = Maybe Text
receipt_
    , push_timeout :: AuthenticationCodeType -> Maybe Int
push_timeout = Maybe Int
push_timeout_
    , _length :: AuthenticationCodeType -> Maybe Int
_length      = Maybe Int
_length_
    }
      = String
"AuthenticationCodeTypeFirebaseIos"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"receipt"      String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
receipt_
        , String
"push_timeout" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
push_timeout_
        , String
"_length"      String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
_length_
        ]

instance AT.FromJSON AuthenticationCodeType where
  parseJSON :: Value -> Parser AuthenticationCodeType
parseJSON v :: Value
v@(AT.Object Object
obj) = do
    String
t <- Object
obj Object -> Key -> Parser String
forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"@type" :: AT.Parser String

    case String
t of
      String
"authenticationCodeTypeTelegramMessage" -> Value -> Parser AuthenticationCodeType
parseAuthenticationCodeTypeTelegramMessage Value
v
      String
"authenticationCodeTypeSms"             -> Value -> Parser AuthenticationCodeType
parseAuthenticationCodeTypeSms Value
v
      String
"authenticationCodeTypeSmsWord"         -> Value -> Parser AuthenticationCodeType
parseAuthenticationCodeTypeSmsWord Value
v
      String
"authenticationCodeTypeSmsPhrase"       -> Value -> Parser AuthenticationCodeType
parseAuthenticationCodeTypeSmsPhrase Value
v
      String
"authenticationCodeTypeCall"            -> Value -> Parser AuthenticationCodeType
parseAuthenticationCodeTypeCall Value
v
      String
"authenticationCodeTypeFlashCall"       -> Value -> Parser AuthenticationCodeType
parseAuthenticationCodeTypeFlashCall Value
v
      String
"authenticationCodeTypeMissedCall"      -> Value -> Parser AuthenticationCodeType
parseAuthenticationCodeTypeMissedCall Value
v
      String
"authenticationCodeTypeFragment"        -> Value -> Parser AuthenticationCodeType
parseAuthenticationCodeTypeFragment Value
v
      String
"authenticationCodeTypeFirebaseAndroid" -> Value -> Parser AuthenticationCodeType
parseAuthenticationCodeTypeFirebaseAndroid Value
v
      String
"authenticationCodeTypeFirebaseIos"     -> Value -> Parser AuthenticationCodeType
parseAuthenticationCodeTypeFirebaseIos Value
v
      String
_                                       -> Parser AuthenticationCodeType
forall a. Monoid a => a
mempty
    
    where
      parseAuthenticationCodeTypeTelegramMessage :: A.Value -> AT.Parser AuthenticationCodeType
      parseAuthenticationCodeTypeTelegramMessage :: Value -> Parser AuthenticationCodeType
parseAuthenticationCodeTypeTelegramMessage = String
-> (Object -> Parser AuthenticationCodeType)
-> Value
-> Parser AuthenticationCodeType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"AuthenticationCodeTypeTelegramMessage" ((Object -> Parser AuthenticationCodeType)
 -> Value -> Parser AuthenticationCodeType)
-> (Object -> Parser AuthenticationCodeType)
-> Value
-> Parser AuthenticationCodeType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Int
_length_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"length"
        AuthenticationCodeType -> Parser AuthenticationCodeType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (AuthenticationCodeType -> Parser AuthenticationCodeType)
-> AuthenticationCodeType -> Parser AuthenticationCodeType
forall a b. (a -> b) -> a -> b
$ AuthenticationCodeTypeTelegramMessage
          { _length :: Maybe Int
_length = Maybe Int
_length_
          }
      parseAuthenticationCodeTypeSms :: A.Value -> AT.Parser AuthenticationCodeType
      parseAuthenticationCodeTypeSms :: Value -> Parser AuthenticationCodeType
parseAuthenticationCodeTypeSms = String
-> (Object -> Parser AuthenticationCodeType)
-> Value
-> Parser AuthenticationCodeType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"AuthenticationCodeTypeSms" ((Object -> Parser AuthenticationCodeType)
 -> Value -> Parser AuthenticationCodeType)
-> (Object -> Parser AuthenticationCodeType)
-> Value
-> Parser AuthenticationCodeType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Int
_length_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"length"
        AuthenticationCodeType -> Parser AuthenticationCodeType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (AuthenticationCodeType -> Parser AuthenticationCodeType)
-> AuthenticationCodeType -> Parser AuthenticationCodeType
forall a b. (a -> b) -> a -> b
$ AuthenticationCodeTypeSms
          { _length :: Maybe Int
_length = Maybe Int
_length_
          }
      parseAuthenticationCodeTypeSmsWord :: A.Value -> AT.Parser AuthenticationCodeType
      parseAuthenticationCodeTypeSmsWord :: Value -> Parser AuthenticationCodeType
parseAuthenticationCodeTypeSmsWord = String
-> (Object -> Parser AuthenticationCodeType)
-> Value
-> Parser AuthenticationCodeType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"AuthenticationCodeTypeSmsWord" ((Object -> Parser AuthenticationCodeType)
 -> Value -> Parser AuthenticationCodeType)
-> (Object -> Parser AuthenticationCodeType)
-> Value
-> Parser AuthenticationCodeType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Text
first_letter_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"first_letter"
        AuthenticationCodeType -> Parser AuthenticationCodeType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (AuthenticationCodeType -> Parser AuthenticationCodeType)
-> AuthenticationCodeType -> Parser AuthenticationCodeType
forall a b. (a -> b) -> a -> b
$ AuthenticationCodeTypeSmsWord
          { first_letter :: Maybe Text
first_letter = Maybe Text
first_letter_
          }
      parseAuthenticationCodeTypeSmsPhrase :: A.Value -> AT.Parser AuthenticationCodeType
      parseAuthenticationCodeTypeSmsPhrase :: Value -> Parser AuthenticationCodeType
parseAuthenticationCodeTypeSmsPhrase = String
-> (Object -> Parser AuthenticationCodeType)
-> Value
-> Parser AuthenticationCodeType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"AuthenticationCodeTypeSmsPhrase" ((Object -> Parser AuthenticationCodeType)
 -> Value -> Parser AuthenticationCodeType)
-> (Object -> Parser AuthenticationCodeType)
-> Value
-> Parser AuthenticationCodeType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Text
first_word_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"first_word"
        AuthenticationCodeType -> Parser AuthenticationCodeType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (AuthenticationCodeType -> Parser AuthenticationCodeType)
-> AuthenticationCodeType -> Parser AuthenticationCodeType
forall a b. (a -> b) -> a -> b
$ AuthenticationCodeTypeSmsPhrase
          { first_word :: Maybe Text
first_word = Maybe Text
first_word_
          }
      parseAuthenticationCodeTypeCall :: A.Value -> AT.Parser AuthenticationCodeType
      parseAuthenticationCodeTypeCall :: Value -> Parser AuthenticationCodeType
parseAuthenticationCodeTypeCall = String
-> (Object -> Parser AuthenticationCodeType)
-> Value
-> Parser AuthenticationCodeType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"AuthenticationCodeTypeCall" ((Object -> Parser AuthenticationCodeType)
 -> Value -> Parser AuthenticationCodeType)
-> (Object -> Parser AuthenticationCodeType)
-> Value
-> Parser AuthenticationCodeType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Int
_length_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"length"
        AuthenticationCodeType -> Parser AuthenticationCodeType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (AuthenticationCodeType -> Parser AuthenticationCodeType)
-> AuthenticationCodeType -> Parser AuthenticationCodeType
forall a b. (a -> b) -> a -> b
$ AuthenticationCodeTypeCall
          { _length :: Maybe Int
_length = Maybe Int
_length_
          }
      parseAuthenticationCodeTypeFlashCall :: A.Value -> AT.Parser AuthenticationCodeType
      parseAuthenticationCodeTypeFlashCall :: Value -> Parser AuthenticationCodeType
parseAuthenticationCodeTypeFlashCall = String
-> (Object -> Parser AuthenticationCodeType)
-> Value
-> Parser AuthenticationCodeType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"AuthenticationCodeTypeFlashCall" ((Object -> Parser AuthenticationCodeType)
 -> Value -> Parser AuthenticationCodeType)
-> (Object -> Parser AuthenticationCodeType)
-> Value
-> Parser AuthenticationCodeType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Text
pattern_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"pattern"
        AuthenticationCodeType -> Parser AuthenticationCodeType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (AuthenticationCodeType -> Parser AuthenticationCodeType)
-> AuthenticationCodeType -> Parser AuthenticationCodeType
forall a b. (a -> b) -> a -> b
$ AuthenticationCodeTypeFlashCall
          { pattern :: Maybe Text
pattern = Maybe Text
pattern_
          }
      parseAuthenticationCodeTypeMissedCall :: A.Value -> AT.Parser AuthenticationCodeType
      parseAuthenticationCodeTypeMissedCall :: Value -> Parser AuthenticationCodeType
parseAuthenticationCodeTypeMissedCall = String
-> (Object -> Parser AuthenticationCodeType)
-> Value
-> Parser AuthenticationCodeType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"AuthenticationCodeTypeMissedCall" ((Object -> Parser AuthenticationCodeType)
 -> Value -> Parser AuthenticationCodeType)
-> (Object -> Parser AuthenticationCodeType)
-> Value
-> Parser AuthenticationCodeType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Text
phone_number_prefix_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"phone_number_prefix"
        Maybe Int
_length_             <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"length"
        AuthenticationCodeType -> Parser AuthenticationCodeType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (AuthenticationCodeType -> Parser AuthenticationCodeType)
-> AuthenticationCodeType -> Parser AuthenticationCodeType
forall a b. (a -> b) -> a -> b
$ AuthenticationCodeTypeMissedCall
          { phone_number_prefix :: Maybe Text
phone_number_prefix = Maybe Text
phone_number_prefix_
          , _length :: Maybe Int
_length             = Maybe Int
_length_
          }
      parseAuthenticationCodeTypeFragment :: A.Value -> AT.Parser AuthenticationCodeType
      parseAuthenticationCodeTypeFragment :: Value -> Parser AuthenticationCodeType
parseAuthenticationCodeTypeFragment = String
-> (Object -> Parser AuthenticationCodeType)
-> Value
-> Parser AuthenticationCodeType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"AuthenticationCodeTypeFragment" ((Object -> Parser AuthenticationCodeType)
 -> Value -> Parser AuthenticationCodeType)
-> (Object -> Parser AuthenticationCodeType)
-> Value
-> Parser AuthenticationCodeType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Text
url_     <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"url"
        Maybe Int
_length_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"length"
        AuthenticationCodeType -> Parser AuthenticationCodeType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (AuthenticationCodeType -> Parser AuthenticationCodeType)
-> AuthenticationCodeType -> Parser AuthenticationCodeType
forall a b. (a -> b) -> a -> b
$ AuthenticationCodeTypeFragment
          { url :: Maybe Text
url     = Maybe Text
url_
          , _length :: Maybe Int
_length = Maybe Int
_length_
          }
      parseAuthenticationCodeTypeFirebaseAndroid :: A.Value -> AT.Parser AuthenticationCodeType
      parseAuthenticationCodeTypeFirebaseAndroid :: Value -> Parser AuthenticationCodeType
parseAuthenticationCodeTypeFirebaseAndroid = String
-> (Object -> Parser AuthenticationCodeType)
-> Value
-> Parser AuthenticationCodeType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"AuthenticationCodeTypeFirebaseAndroid" ((Object -> Parser AuthenticationCodeType)
 -> Value -> Parser AuthenticationCodeType)
-> (Object -> Parser AuthenticationCodeType)
-> Value
-> Parser AuthenticationCodeType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe FirebaseDeviceVerificationParameters
device_verification_parameters_ <- Object
o Object
-> Key -> Parser (Maybe FirebaseDeviceVerificationParameters)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"device_verification_parameters"
        Maybe Int
_length_                        <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"length"
        AuthenticationCodeType -> Parser AuthenticationCodeType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (AuthenticationCodeType -> Parser AuthenticationCodeType)
-> AuthenticationCodeType -> Parser AuthenticationCodeType
forall a b. (a -> b) -> a -> b
$ AuthenticationCodeTypeFirebaseAndroid
          { device_verification_parameters :: Maybe FirebaseDeviceVerificationParameters
device_verification_parameters = Maybe FirebaseDeviceVerificationParameters
device_verification_parameters_
          , _length :: Maybe Int
_length                        = Maybe Int
_length_
          }
      parseAuthenticationCodeTypeFirebaseIos :: A.Value -> AT.Parser AuthenticationCodeType
      parseAuthenticationCodeTypeFirebaseIos :: Value -> Parser AuthenticationCodeType
parseAuthenticationCodeTypeFirebaseIos = String
-> (Object -> Parser AuthenticationCodeType)
-> Value
-> Parser AuthenticationCodeType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"AuthenticationCodeTypeFirebaseIos" ((Object -> Parser AuthenticationCodeType)
 -> Value -> Parser AuthenticationCodeType)
-> (Object -> Parser AuthenticationCodeType)
-> Value
-> Parser AuthenticationCodeType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Text
receipt_      <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"receipt"
        Maybe Int
push_timeout_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"push_timeout"
        Maybe Int
_length_      <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"length"
        AuthenticationCodeType -> Parser AuthenticationCodeType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (AuthenticationCodeType -> Parser AuthenticationCodeType)
-> AuthenticationCodeType -> Parser AuthenticationCodeType
forall a b. (a -> b) -> a -> b
$ AuthenticationCodeTypeFirebaseIos
          { receipt :: Maybe Text
receipt      = Maybe Text
receipt_
          , push_timeout :: Maybe Int
push_timeout = Maybe Int
push_timeout_
          , _length :: Maybe Int
_length      = Maybe Int
_length_
          }
  parseJSON Value
_ = Parser AuthenticationCodeType
forall a. Monoid a => a
mempty