/*
authentik

Making authentication simple.

API version: 2026.5.0-rc1
Contact: hello@goauthentik.io
*/

// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.

package api

import (
	"encoding/json"
	"fmt"
)

// FlowChallengeResponseRequest - struct for FlowChallengeResponseRequest
type FlowChallengeResponseRequest struct {
	AppleChallengeResponseRequest                   *AppleChallengeResponseRequest
	AuthenticatorDuoChallengeResponseRequest        *AuthenticatorDuoChallengeResponseRequest
	AuthenticatorEmailChallengeResponseRequest      *AuthenticatorEmailChallengeResponseRequest
	AuthenticatorSMSChallengeResponseRequest        *AuthenticatorSMSChallengeResponseRequest
	AuthenticatorStaticChallengeResponseRequest     *AuthenticatorStaticChallengeResponseRequest
	AuthenticatorTOTPChallengeResponseRequest       *AuthenticatorTOTPChallengeResponseRequest
	AuthenticatorValidationChallengeResponseRequest *AuthenticatorValidationChallengeResponseRequest
	AuthenticatorWebAuthnChallengeResponseRequest   *AuthenticatorWebAuthnChallengeResponseRequest
	AutoSubmitChallengeResponseRequest              *AutoSubmitChallengeResponseRequest
	CaptchaChallengeResponseRequest                 *CaptchaChallengeResponseRequest
	ConsentChallengeResponseRequest                 *ConsentChallengeResponseRequest
	DummyChallengeResponseRequest                   *DummyChallengeResponseRequest
	EmailChallengeResponseRequest                   *EmailChallengeResponseRequest
	EndpointAgentChallengeResponseRequest           *EndpointAgentChallengeResponseRequest
	FrameChallengeResponseRequest                   *FrameChallengeResponseRequest
	IdentificationChallengeResponseRequest          *IdentificationChallengeResponseRequest
	IframeLogoutChallengeResponseRequest            *IframeLogoutChallengeResponseRequest
	NativeLogoutChallengeResponseRequest            *NativeLogoutChallengeResponseRequest
	OAuthDeviceCodeChallengeResponseRequest         *OAuthDeviceCodeChallengeResponseRequest
	OAuthDeviceCodeFinishChallengeResponseRequest   *OAuthDeviceCodeFinishChallengeResponseRequest
	PasswordChallengeResponseRequest                *PasswordChallengeResponseRequest
	PlexAuthenticationChallengeResponseRequest      *PlexAuthenticationChallengeResponseRequest
	PromptChallengeResponseRequest                  *PromptChallengeResponseRequest
	RedirectChallengeResponseRequest                *RedirectChallengeResponseRequest
	TelegramChallengeResponseRequest                *TelegramChallengeResponseRequest
	UserLoginChallengeResponseRequest               *UserLoginChallengeResponseRequest
}

// AppleChallengeResponseRequestAsFlowChallengeResponseRequest is a convenience function that returns AppleChallengeResponseRequest wrapped in FlowChallengeResponseRequest
func AppleChallengeResponseRequestAsFlowChallengeResponseRequest(v *AppleChallengeResponseRequest) FlowChallengeResponseRequest {
	return FlowChallengeResponseRequest{
		AppleChallengeResponseRequest: v,
	}
}

// AuthenticatorDuoChallengeResponseRequestAsFlowChallengeResponseRequest is a convenience function that returns AuthenticatorDuoChallengeResponseRequest wrapped in FlowChallengeResponseRequest
func AuthenticatorDuoChallengeResponseRequestAsFlowChallengeResponseRequest(v *AuthenticatorDuoChallengeResponseRequest) FlowChallengeResponseRequest {
	return FlowChallengeResponseRequest{
		AuthenticatorDuoChallengeResponseRequest: v,
	}
}

// AuthenticatorEmailChallengeResponseRequestAsFlowChallengeResponseRequest is a convenience function that returns AuthenticatorEmailChallengeResponseRequest wrapped in FlowChallengeResponseRequest
func AuthenticatorEmailChallengeResponseRequestAsFlowChallengeResponseRequest(v *AuthenticatorEmailChallengeResponseRequest) FlowChallengeResponseRequest {
	return FlowChallengeResponseRequest{
		AuthenticatorEmailChallengeResponseRequest: v,
	}
}

// AuthenticatorSMSChallengeResponseRequestAsFlowChallengeResponseRequest is a convenience function that returns AuthenticatorSMSChallengeResponseRequest wrapped in FlowChallengeResponseRequest
func AuthenticatorSMSChallengeResponseRequestAsFlowChallengeResponseRequest(v *AuthenticatorSMSChallengeResponseRequest) FlowChallengeResponseRequest {
	return FlowChallengeResponseRequest{
		AuthenticatorSMSChallengeResponseRequest: v,
	}
}

// AuthenticatorStaticChallengeResponseRequestAsFlowChallengeResponseRequest is a convenience function that returns AuthenticatorStaticChallengeResponseRequest wrapped in FlowChallengeResponseRequest
func AuthenticatorStaticChallengeResponseRequestAsFlowChallengeResponseRequest(v *AuthenticatorStaticChallengeResponseRequest) FlowChallengeResponseRequest {
	return FlowChallengeResponseRequest{
		AuthenticatorStaticChallengeResponseRequest: v,
	}
}

// AuthenticatorTOTPChallengeResponseRequestAsFlowChallengeResponseRequest is a convenience function that returns AuthenticatorTOTPChallengeResponseRequest wrapped in FlowChallengeResponseRequest
func AuthenticatorTOTPChallengeResponseRequestAsFlowChallengeResponseRequest(v *AuthenticatorTOTPChallengeResponseRequest) FlowChallengeResponseRequest {
	return FlowChallengeResponseRequest{
		AuthenticatorTOTPChallengeResponseRequest: v,
	}
}

// AuthenticatorValidationChallengeResponseRequestAsFlowChallengeResponseRequest is a convenience function that returns AuthenticatorValidationChallengeResponseRequest wrapped in FlowChallengeResponseRequest
func AuthenticatorValidationChallengeResponseRequestAsFlowChallengeResponseRequest(v *AuthenticatorValidationChallengeResponseRequest) FlowChallengeResponseRequest {
	return FlowChallengeResponseRequest{
		AuthenticatorValidationChallengeResponseRequest: v,
	}
}

// AuthenticatorWebAuthnChallengeResponseRequestAsFlowChallengeResponseRequest is a convenience function that returns AuthenticatorWebAuthnChallengeResponseRequest wrapped in FlowChallengeResponseRequest
func AuthenticatorWebAuthnChallengeResponseRequestAsFlowChallengeResponseRequest(v *AuthenticatorWebAuthnChallengeResponseRequest) FlowChallengeResponseRequest {
	return FlowChallengeResponseRequest{
		AuthenticatorWebAuthnChallengeResponseRequest: v,
	}
}

// AutoSubmitChallengeResponseRequestAsFlowChallengeResponseRequest is a convenience function that returns AutoSubmitChallengeResponseRequest wrapped in FlowChallengeResponseRequest
func AutoSubmitChallengeResponseRequestAsFlowChallengeResponseRequest(v *AutoSubmitChallengeResponseRequest) FlowChallengeResponseRequest {
	return FlowChallengeResponseRequest{
		AutoSubmitChallengeResponseRequest: v,
	}
}

// CaptchaChallengeResponseRequestAsFlowChallengeResponseRequest is a convenience function that returns CaptchaChallengeResponseRequest wrapped in FlowChallengeResponseRequest
func CaptchaChallengeResponseRequestAsFlowChallengeResponseRequest(v *CaptchaChallengeResponseRequest) FlowChallengeResponseRequest {
	return FlowChallengeResponseRequest{
		CaptchaChallengeResponseRequest: v,
	}
}

// ConsentChallengeResponseRequestAsFlowChallengeResponseRequest is a convenience function that returns ConsentChallengeResponseRequest wrapped in FlowChallengeResponseRequest
func ConsentChallengeResponseRequestAsFlowChallengeResponseRequest(v *ConsentChallengeResponseRequest) FlowChallengeResponseRequest {
	return FlowChallengeResponseRequest{
		ConsentChallengeResponseRequest: v,
	}
}

// DummyChallengeResponseRequestAsFlowChallengeResponseRequest is a convenience function that returns DummyChallengeResponseRequest wrapped in FlowChallengeResponseRequest
func DummyChallengeResponseRequestAsFlowChallengeResponseRequest(v *DummyChallengeResponseRequest) FlowChallengeResponseRequest {
	return FlowChallengeResponseRequest{
		DummyChallengeResponseRequest: v,
	}
}

// EmailChallengeResponseRequestAsFlowChallengeResponseRequest is a convenience function that returns EmailChallengeResponseRequest wrapped in FlowChallengeResponseRequest
func EmailChallengeResponseRequestAsFlowChallengeResponseRequest(v *EmailChallengeResponseRequest) FlowChallengeResponseRequest {
	return FlowChallengeResponseRequest{
		EmailChallengeResponseRequest: v,
	}
}

// EndpointAgentChallengeResponseRequestAsFlowChallengeResponseRequest is a convenience function that returns EndpointAgentChallengeResponseRequest wrapped in FlowChallengeResponseRequest
func EndpointAgentChallengeResponseRequestAsFlowChallengeResponseRequest(v *EndpointAgentChallengeResponseRequest) FlowChallengeResponseRequest {
	return FlowChallengeResponseRequest{
		EndpointAgentChallengeResponseRequest: v,
	}
}

// FrameChallengeResponseRequestAsFlowChallengeResponseRequest is a convenience function that returns FrameChallengeResponseRequest wrapped in FlowChallengeResponseRequest
func FrameChallengeResponseRequestAsFlowChallengeResponseRequest(v *FrameChallengeResponseRequest) FlowChallengeResponseRequest {
	return FlowChallengeResponseRequest{
		FrameChallengeResponseRequest: v,
	}
}

// IdentificationChallengeResponseRequestAsFlowChallengeResponseRequest is a convenience function that returns IdentificationChallengeResponseRequest wrapped in FlowChallengeResponseRequest
func IdentificationChallengeResponseRequestAsFlowChallengeResponseRequest(v *IdentificationChallengeResponseRequest) FlowChallengeResponseRequest {
	return FlowChallengeResponseRequest{
		IdentificationChallengeResponseRequest: v,
	}
}

// IframeLogoutChallengeResponseRequestAsFlowChallengeResponseRequest is a convenience function that returns IframeLogoutChallengeResponseRequest wrapped in FlowChallengeResponseRequest
func IframeLogoutChallengeResponseRequestAsFlowChallengeResponseRequest(v *IframeLogoutChallengeResponseRequest) FlowChallengeResponseRequest {
	return FlowChallengeResponseRequest{
		IframeLogoutChallengeResponseRequest: v,
	}
}

// NativeLogoutChallengeResponseRequestAsFlowChallengeResponseRequest is a convenience function that returns NativeLogoutChallengeResponseRequest wrapped in FlowChallengeResponseRequest
func NativeLogoutChallengeResponseRequestAsFlowChallengeResponseRequest(v *NativeLogoutChallengeResponseRequest) FlowChallengeResponseRequest {
	return FlowChallengeResponseRequest{
		NativeLogoutChallengeResponseRequest: v,
	}
}

// OAuthDeviceCodeChallengeResponseRequestAsFlowChallengeResponseRequest is a convenience function that returns OAuthDeviceCodeChallengeResponseRequest wrapped in FlowChallengeResponseRequest
func OAuthDeviceCodeChallengeResponseRequestAsFlowChallengeResponseRequest(v *OAuthDeviceCodeChallengeResponseRequest) FlowChallengeResponseRequest {
	return FlowChallengeResponseRequest{
		OAuthDeviceCodeChallengeResponseRequest: v,
	}
}

// OAuthDeviceCodeFinishChallengeResponseRequestAsFlowChallengeResponseRequest is a convenience function that returns OAuthDeviceCodeFinishChallengeResponseRequest wrapped in FlowChallengeResponseRequest
func OAuthDeviceCodeFinishChallengeResponseRequestAsFlowChallengeResponseRequest(v *OAuthDeviceCodeFinishChallengeResponseRequest) FlowChallengeResponseRequest {
	return FlowChallengeResponseRequest{
		OAuthDeviceCodeFinishChallengeResponseRequest: v,
	}
}

// PasswordChallengeResponseRequestAsFlowChallengeResponseRequest is a convenience function that returns PasswordChallengeResponseRequest wrapped in FlowChallengeResponseRequest
func PasswordChallengeResponseRequestAsFlowChallengeResponseRequest(v *PasswordChallengeResponseRequest) FlowChallengeResponseRequest {
	return FlowChallengeResponseRequest{
		PasswordChallengeResponseRequest: v,
	}
}

// PlexAuthenticationChallengeResponseRequestAsFlowChallengeResponseRequest is a convenience function that returns PlexAuthenticationChallengeResponseRequest wrapped in FlowChallengeResponseRequest
func PlexAuthenticationChallengeResponseRequestAsFlowChallengeResponseRequest(v *PlexAuthenticationChallengeResponseRequest) FlowChallengeResponseRequest {
	return FlowChallengeResponseRequest{
		PlexAuthenticationChallengeResponseRequest: v,
	}
}

// PromptChallengeResponseRequestAsFlowChallengeResponseRequest is a convenience function that returns PromptChallengeResponseRequest wrapped in FlowChallengeResponseRequest
func PromptChallengeResponseRequestAsFlowChallengeResponseRequest(v *PromptChallengeResponseRequest) FlowChallengeResponseRequest {
	return FlowChallengeResponseRequest{
		PromptChallengeResponseRequest: v,
	}
}

// RedirectChallengeResponseRequestAsFlowChallengeResponseRequest is a convenience function that returns RedirectChallengeResponseRequest wrapped in FlowChallengeResponseRequest
func RedirectChallengeResponseRequestAsFlowChallengeResponseRequest(v *RedirectChallengeResponseRequest) FlowChallengeResponseRequest {
	return FlowChallengeResponseRequest{
		RedirectChallengeResponseRequest: v,
	}
}

// TelegramChallengeResponseRequestAsFlowChallengeResponseRequest is a convenience function that returns TelegramChallengeResponseRequest wrapped in FlowChallengeResponseRequest
func TelegramChallengeResponseRequestAsFlowChallengeResponseRequest(v *TelegramChallengeResponseRequest) FlowChallengeResponseRequest {
	return FlowChallengeResponseRequest{
		TelegramChallengeResponseRequest: v,
	}
}

// UserLoginChallengeResponseRequestAsFlowChallengeResponseRequest is a convenience function that returns UserLoginChallengeResponseRequest wrapped in FlowChallengeResponseRequest
func UserLoginChallengeResponseRequestAsFlowChallengeResponseRequest(v *UserLoginChallengeResponseRequest) FlowChallengeResponseRequest {
	return FlowChallengeResponseRequest{
		UserLoginChallengeResponseRequest: v,
	}
}

// Unmarshal JSON data into one of the pointers in the struct
func (dst *FlowChallengeResponseRequest) UnmarshalJSON(data []byte) error {
	var err error
	// use discriminator value to speed up the lookup
	var jsonDict map[string]interface{}
	err = newStrictDecoder(data).Decode(&jsonDict)
	if err != nil {
		return fmt.Errorf("failed to unmarshal JSON into map for the discriminator lookup")
	}

	// check if the discriminator value is 'ak-provider-iframe-logout'
	if jsonDict["component"] == "ak-provider-iframe-logout" {
		// try to unmarshal JSON data into IframeLogoutChallengeResponseRequest
		err = json.Unmarshal(data, &dst.IframeLogoutChallengeResponseRequest)
		if err == nil {
			return nil // data stored in dst.IframeLogoutChallengeResponseRequest, return on the first match
		} else {
			dst.IframeLogoutChallengeResponseRequest = nil
			return fmt.Errorf("failed to unmarshal FlowChallengeResponseRequest as IframeLogoutChallengeResponseRequest: %s", err.Error())
		}
	}

	// check if the discriminator value is 'ak-provider-oauth2-device-code'
	if jsonDict["component"] == "ak-provider-oauth2-device-code" {
		// try to unmarshal JSON data into OAuthDeviceCodeChallengeResponseRequest
		err = json.Unmarshal(data, &dst.OAuthDeviceCodeChallengeResponseRequest)
		if err == nil {
			return nil // data stored in dst.OAuthDeviceCodeChallengeResponseRequest, return on the first match
		} else {
			dst.OAuthDeviceCodeChallengeResponseRequest = nil
			return fmt.Errorf("failed to unmarshal FlowChallengeResponseRequest as OAuthDeviceCodeChallengeResponseRequest: %s", err.Error())
		}
	}

	// check if the discriminator value is 'ak-provider-oauth2-device-code-finish'
	if jsonDict["component"] == "ak-provider-oauth2-device-code-finish" {
		// try to unmarshal JSON data into OAuthDeviceCodeFinishChallengeResponseRequest
		err = json.Unmarshal(data, &dst.OAuthDeviceCodeFinishChallengeResponseRequest)
		if err == nil {
			return nil // data stored in dst.OAuthDeviceCodeFinishChallengeResponseRequest, return on the first match
		} else {
			dst.OAuthDeviceCodeFinishChallengeResponseRequest = nil
			return fmt.Errorf("failed to unmarshal FlowChallengeResponseRequest as OAuthDeviceCodeFinishChallengeResponseRequest: %s", err.Error())
		}
	}

	// check if the discriminator value is 'ak-provider-saml-native-logout'
	if jsonDict["component"] == "ak-provider-saml-native-logout" {
		// try to unmarshal JSON data into NativeLogoutChallengeResponseRequest
		err = json.Unmarshal(data, &dst.NativeLogoutChallengeResponseRequest)
		if err == nil {
			return nil // data stored in dst.NativeLogoutChallengeResponseRequest, return on the first match
		} else {
			dst.NativeLogoutChallengeResponseRequest = nil
			return fmt.Errorf("failed to unmarshal FlowChallengeResponseRequest as NativeLogoutChallengeResponseRequest: %s", err.Error())
		}
	}

	// check if the discriminator value is 'ak-source-oauth-apple'
	if jsonDict["component"] == "ak-source-oauth-apple" {
		// try to unmarshal JSON data into AppleChallengeResponseRequest
		err = json.Unmarshal(data, &dst.AppleChallengeResponseRequest)
		if err == nil {
			return nil // data stored in dst.AppleChallengeResponseRequest, return on the first match
		} else {
			dst.AppleChallengeResponseRequest = nil
			return fmt.Errorf("failed to unmarshal FlowChallengeResponseRequest as AppleChallengeResponseRequest: %s", err.Error())
		}
	}

	// check if the discriminator value is 'ak-source-plex'
	if jsonDict["component"] == "ak-source-plex" {
		// try to unmarshal JSON data into PlexAuthenticationChallengeResponseRequest
		err = json.Unmarshal(data, &dst.PlexAuthenticationChallengeResponseRequest)
		if err == nil {
			return nil // data stored in dst.PlexAuthenticationChallengeResponseRequest, return on the first match
		} else {
			dst.PlexAuthenticationChallengeResponseRequest = nil
			return fmt.Errorf("failed to unmarshal FlowChallengeResponseRequest as PlexAuthenticationChallengeResponseRequest: %s", err.Error())
		}
	}

	// check if the discriminator value is 'ak-source-telegram'
	if jsonDict["component"] == "ak-source-telegram" {
		// try to unmarshal JSON data into TelegramChallengeResponseRequest
		err = json.Unmarshal(data, &dst.TelegramChallengeResponseRequest)
		if err == nil {
			return nil // data stored in dst.TelegramChallengeResponseRequest, return on the first match
		} else {
			dst.TelegramChallengeResponseRequest = nil
			return fmt.Errorf("failed to unmarshal FlowChallengeResponseRequest as TelegramChallengeResponseRequest: %s", err.Error())
		}
	}

	// check if the discriminator value is 'ak-stage-authenticator-duo'
	if jsonDict["component"] == "ak-stage-authenticator-duo" {
		// try to unmarshal JSON data into AuthenticatorDuoChallengeResponseRequest
		err = json.Unmarshal(data, &dst.AuthenticatorDuoChallengeResponseRequest)
		if err == nil {
			return nil // data stored in dst.AuthenticatorDuoChallengeResponseRequest, return on the first match
		} else {
			dst.AuthenticatorDuoChallengeResponseRequest = nil
			return fmt.Errorf("failed to unmarshal FlowChallengeResponseRequest as AuthenticatorDuoChallengeResponseRequest: %s", err.Error())
		}
	}

	// check if the discriminator value is 'ak-stage-authenticator-email'
	if jsonDict["component"] == "ak-stage-authenticator-email" {
		// try to unmarshal JSON data into AuthenticatorEmailChallengeResponseRequest
		err = json.Unmarshal(data, &dst.AuthenticatorEmailChallengeResponseRequest)
		if err == nil {
			return nil // data stored in dst.AuthenticatorEmailChallengeResponseRequest, return on the first match
		} else {
			dst.AuthenticatorEmailChallengeResponseRequest = nil
			return fmt.Errorf("failed to unmarshal FlowChallengeResponseRequest as AuthenticatorEmailChallengeResponseRequest: %s", err.Error())
		}
	}

	// check if the discriminator value is 'ak-stage-authenticator-sms'
	if jsonDict["component"] == "ak-stage-authenticator-sms" {
		// try to unmarshal JSON data into AuthenticatorSMSChallengeResponseRequest
		err = json.Unmarshal(data, &dst.AuthenticatorSMSChallengeResponseRequest)
		if err == nil {
			return nil // data stored in dst.AuthenticatorSMSChallengeResponseRequest, return on the first match
		} else {
			dst.AuthenticatorSMSChallengeResponseRequest = nil
			return fmt.Errorf("failed to unmarshal FlowChallengeResponseRequest as AuthenticatorSMSChallengeResponseRequest: %s", err.Error())
		}
	}

	// check if the discriminator value is 'ak-stage-authenticator-static'
	if jsonDict["component"] == "ak-stage-authenticator-static" {
		// try to unmarshal JSON data into AuthenticatorStaticChallengeResponseRequest
		err = json.Unmarshal(data, &dst.AuthenticatorStaticChallengeResponseRequest)
		if err == nil {
			return nil // data stored in dst.AuthenticatorStaticChallengeResponseRequest, return on the first match
		} else {
			dst.AuthenticatorStaticChallengeResponseRequest = nil
			return fmt.Errorf("failed to unmarshal FlowChallengeResponseRequest as AuthenticatorStaticChallengeResponseRequest: %s", err.Error())
		}
	}

	// check if the discriminator value is 'ak-stage-authenticator-totp'
	if jsonDict["component"] == "ak-stage-authenticator-totp" {
		// try to unmarshal JSON data into AuthenticatorTOTPChallengeResponseRequest
		err = json.Unmarshal(data, &dst.AuthenticatorTOTPChallengeResponseRequest)
		if err == nil {
			return nil // data stored in dst.AuthenticatorTOTPChallengeResponseRequest, return on the first match
		} else {
			dst.AuthenticatorTOTPChallengeResponseRequest = nil
			return fmt.Errorf("failed to unmarshal FlowChallengeResponseRequest as AuthenticatorTOTPChallengeResponseRequest: %s", err.Error())
		}
	}

	// check if the discriminator value is 'ak-stage-authenticator-validate'
	if jsonDict["component"] == "ak-stage-authenticator-validate" {
		// try to unmarshal JSON data into AuthenticatorValidationChallengeResponseRequest
		err = json.Unmarshal(data, &dst.AuthenticatorValidationChallengeResponseRequest)
		if err == nil {
			return nil // data stored in dst.AuthenticatorValidationChallengeResponseRequest, return on the first match
		} else {
			dst.AuthenticatorValidationChallengeResponseRequest = nil
			return fmt.Errorf("failed to unmarshal FlowChallengeResponseRequest as AuthenticatorValidationChallengeResponseRequest: %s", err.Error())
		}
	}

	// check if the discriminator value is 'ak-stage-authenticator-webauthn'
	if jsonDict["component"] == "ak-stage-authenticator-webauthn" {
		// try to unmarshal JSON data into AuthenticatorWebAuthnChallengeResponseRequest
		err = json.Unmarshal(data, &dst.AuthenticatorWebAuthnChallengeResponseRequest)
		if err == nil {
			return nil // data stored in dst.AuthenticatorWebAuthnChallengeResponseRequest, return on the first match
		} else {
			dst.AuthenticatorWebAuthnChallengeResponseRequest = nil
			return fmt.Errorf("failed to unmarshal FlowChallengeResponseRequest as AuthenticatorWebAuthnChallengeResponseRequest: %s", err.Error())
		}
	}

	// check if the discriminator value is 'ak-stage-autosubmit'
	if jsonDict["component"] == "ak-stage-autosubmit" {
		// try to unmarshal JSON data into AutoSubmitChallengeResponseRequest
		err = json.Unmarshal(data, &dst.AutoSubmitChallengeResponseRequest)
		if err == nil {
			return nil // data stored in dst.AutoSubmitChallengeResponseRequest, return on the first match
		} else {
			dst.AutoSubmitChallengeResponseRequest = nil
			return fmt.Errorf("failed to unmarshal FlowChallengeResponseRequest as AutoSubmitChallengeResponseRequest: %s", err.Error())
		}
	}

	// check if the discriminator value is 'ak-stage-captcha'
	if jsonDict["component"] == "ak-stage-captcha" {
		// try to unmarshal JSON data into CaptchaChallengeResponseRequest
		err = json.Unmarshal(data, &dst.CaptchaChallengeResponseRequest)
		if err == nil {
			return nil // data stored in dst.CaptchaChallengeResponseRequest, return on the first match
		} else {
			dst.CaptchaChallengeResponseRequest = nil
			return fmt.Errorf("failed to unmarshal FlowChallengeResponseRequest as CaptchaChallengeResponseRequest: %s", err.Error())
		}
	}

	// check if the discriminator value is 'ak-stage-consent'
	if jsonDict["component"] == "ak-stage-consent" {
		// try to unmarshal JSON data into ConsentChallengeResponseRequest
		err = json.Unmarshal(data, &dst.ConsentChallengeResponseRequest)
		if err == nil {
			return nil // data stored in dst.ConsentChallengeResponseRequest, return on the first match
		} else {
			dst.ConsentChallengeResponseRequest = nil
			return fmt.Errorf("failed to unmarshal FlowChallengeResponseRequest as ConsentChallengeResponseRequest: %s", err.Error())
		}
	}

	// check if the discriminator value is 'ak-stage-dummy'
	if jsonDict["component"] == "ak-stage-dummy" {
		// try to unmarshal JSON data into DummyChallengeResponseRequest
		err = json.Unmarshal(data, &dst.DummyChallengeResponseRequest)
		if err == nil {
			return nil // data stored in dst.DummyChallengeResponseRequest, return on the first match
		} else {
			dst.DummyChallengeResponseRequest = nil
			return fmt.Errorf("failed to unmarshal FlowChallengeResponseRequest as DummyChallengeResponseRequest: %s", err.Error())
		}
	}

	// check if the discriminator value is 'ak-stage-email'
	if jsonDict["component"] == "ak-stage-email" {
		// try to unmarshal JSON data into EmailChallengeResponseRequest
		err = json.Unmarshal(data, &dst.EmailChallengeResponseRequest)
		if err == nil {
			return nil // data stored in dst.EmailChallengeResponseRequest, return on the first match
		} else {
			dst.EmailChallengeResponseRequest = nil
			return fmt.Errorf("failed to unmarshal FlowChallengeResponseRequest as EmailChallengeResponseRequest: %s", err.Error())
		}
	}

	// check if the discriminator value is 'ak-stage-endpoint-agent'
	if jsonDict["component"] == "ak-stage-endpoint-agent" {
		// try to unmarshal JSON data into EndpointAgentChallengeResponseRequest
		err = json.Unmarshal(data, &dst.EndpointAgentChallengeResponseRequest)
		if err == nil {
			return nil // data stored in dst.EndpointAgentChallengeResponseRequest, return on the first match
		} else {
			dst.EndpointAgentChallengeResponseRequest = nil
			return fmt.Errorf("failed to unmarshal FlowChallengeResponseRequest as EndpointAgentChallengeResponseRequest: %s", err.Error())
		}
	}

	// check if the discriminator value is 'ak-stage-identification'
	if jsonDict["component"] == "ak-stage-identification" {
		// try to unmarshal JSON data into IdentificationChallengeResponseRequest
		err = json.Unmarshal(data, &dst.IdentificationChallengeResponseRequest)
		if err == nil {
			return nil // data stored in dst.IdentificationChallengeResponseRequest, return on the first match
		} else {
			dst.IdentificationChallengeResponseRequest = nil
			return fmt.Errorf("failed to unmarshal FlowChallengeResponseRequest as IdentificationChallengeResponseRequest: %s", err.Error())
		}
	}

	// check if the discriminator value is 'ak-stage-password'
	if jsonDict["component"] == "ak-stage-password" {
		// try to unmarshal JSON data into PasswordChallengeResponseRequest
		err = json.Unmarshal(data, &dst.PasswordChallengeResponseRequest)
		if err == nil {
			return nil // data stored in dst.PasswordChallengeResponseRequest, return on the first match
		} else {
			dst.PasswordChallengeResponseRequest = nil
			return fmt.Errorf("failed to unmarshal FlowChallengeResponseRequest as PasswordChallengeResponseRequest: %s", err.Error())
		}
	}

	// check if the discriminator value is 'ak-stage-prompt'
	if jsonDict["component"] == "ak-stage-prompt" {
		// try to unmarshal JSON data into PromptChallengeResponseRequest
		err = json.Unmarshal(data, &dst.PromptChallengeResponseRequest)
		if err == nil {
			return nil // data stored in dst.PromptChallengeResponseRequest, return on the first match
		} else {
			dst.PromptChallengeResponseRequest = nil
			return fmt.Errorf("failed to unmarshal FlowChallengeResponseRequest as PromptChallengeResponseRequest: %s", err.Error())
		}
	}

	// check if the discriminator value is 'ak-stage-user-login'
	if jsonDict["component"] == "ak-stage-user-login" {
		// try to unmarshal JSON data into UserLoginChallengeResponseRequest
		err = json.Unmarshal(data, &dst.UserLoginChallengeResponseRequest)
		if err == nil {
			return nil // data stored in dst.UserLoginChallengeResponseRequest, return on the first match
		} else {
			dst.UserLoginChallengeResponseRequest = nil
			return fmt.Errorf("failed to unmarshal FlowChallengeResponseRequest as UserLoginChallengeResponseRequest: %s", err.Error())
		}
	}

	// check if the discriminator value is 'xak-flow-frame'
	if jsonDict["component"] == "xak-flow-frame" {
		// try to unmarshal JSON data into FrameChallengeResponseRequest
		err = json.Unmarshal(data, &dst.FrameChallengeResponseRequest)
		if err == nil {
			return nil // data stored in dst.FrameChallengeResponseRequest, return on the first match
		} else {
			dst.FrameChallengeResponseRequest = nil
			return fmt.Errorf("failed to unmarshal FlowChallengeResponseRequest as FrameChallengeResponseRequest: %s", err.Error())
		}
	}

	// check if the discriminator value is 'xak-flow-redirect'
	if jsonDict["component"] == "xak-flow-redirect" {
		// try to unmarshal JSON data into RedirectChallengeResponseRequest
		err = json.Unmarshal(data, &dst.RedirectChallengeResponseRequest)
		if err == nil {
			return nil // data stored in dst.RedirectChallengeResponseRequest, return on the first match
		} else {
			dst.RedirectChallengeResponseRequest = nil
			return fmt.Errorf("failed to unmarshal FlowChallengeResponseRequest as RedirectChallengeResponseRequest: %s", err.Error())
		}
	}

	return nil
}

// Marshal data from the first non-nil pointers in the struct to JSON
func (src FlowChallengeResponseRequest) MarshalJSON() ([]byte, error) {
	if src.AppleChallengeResponseRequest != nil {
		return json.Marshal(&src.AppleChallengeResponseRequest)
	}

	if src.AuthenticatorDuoChallengeResponseRequest != nil {
		return json.Marshal(&src.AuthenticatorDuoChallengeResponseRequest)
	}

	if src.AuthenticatorEmailChallengeResponseRequest != nil {
		return json.Marshal(&src.AuthenticatorEmailChallengeResponseRequest)
	}

	if src.AuthenticatorSMSChallengeResponseRequest != nil {
		return json.Marshal(&src.AuthenticatorSMSChallengeResponseRequest)
	}

	if src.AuthenticatorStaticChallengeResponseRequest != nil {
		return json.Marshal(&src.AuthenticatorStaticChallengeResponseRequest)
	}

	if src.AuthenticatorTOTPChallengeResponseRequest != nil {
		return json.Marshal(&src.AuthenticatorTOTPChallengeResponseRequest)
	}

	if src.AuthenticatorValidationChallengeResponseRequest != nil {
		return json.Marshal(&src.AuthenticatorValidationChallengeResponseRequest)
	}

	if src.AuthenticatorWebAuthnChallengeResponseRequest != nil {
		return json.Marshal(&src.AuthenticatorWebAuthnChallengeResponseRequest)
	}

	if src.AutoSubmitChallengeResponseRequest != nil {
		return json.Marshal(&src.AutoSubmitChallengeResponseRequest)
	}

	if src.CaptchaChallengeResponseRequest != nil {
		return json.Marshal(&src.CaptchaChallengeResponseRequest)
	}

	if src.ConsentChallengeResponseRequest != nil {
		return json.Marshal(&src.ConsentChallengeResponseRequest)
	}

	if src.DummyChallengeResponseRequest != nil {
		return json.Marshal(&src.DummyChallengeResponseRequest)
	}

	if src.EmailChallengeResponseRequest != nil {
		return json.Marshal(&src.EmailChallengeResponseRequest)
	}

	if src.EndpointAgentChallengeResponseRequest != nil {
		return json.Marshal(&src.EndpointAgentChallengeResponseRequest)
	}

	if src.FrameChallengeResponseRequest != nil {
		return json.Marshal(&src.FrameChallengeResponseRequest)
	}

	if src.IdentificationChallengeResponseRequest != nil {
		return json.Marshal(&src.IdentificationChallengeResponseRequest)
	}

	if src.IframeLogoutChallengeResponseRequest != nil {
		return json.Marshal(&src.IframeLogoutChallengeResponseRequest)
	}

	if src.NativeLogoutChallengeResponseRequest != nil {
		return json.Marshal(&src.NativeLogoutChallengeResponseRequest)
	}

	if src.OAuthDeviceCodeChallengeResponseRequest != nil {
		return json.Marshal(&src.OAuthDeviceCodeChallengeResponseRequest)
	}

	if src.OAuthDeviceCodeFinishChallengeResponseRequest != nil {
		return json.Marshal(&src.OAuthDeviceCodeFinishChallengeResponseRequest)
	}

	if src.PasswordChallengeResponseRequest != nil {
		return json.Marshal(&src.PasswordChallengeResponseRequest)
	}

	if src.PlexAuthenticationChallengeResponseRequest != nil {
		return json.Marshal(&src.PlexAuthenticationChallengeResponseRequest)
	}

	if src.PromptChallengeResponseRequest != nil {
		return json.Marshal(&src.PromptChallengeResponseRequest)
	}

	if src.RedirectChallengeResponseRequest != nil {
		return json.Marshal(&src.RedirectChallengeResponseRequest)
	}

	if src.TelegramChallengeResponseRequest != nil {
		return json.Marshal(&src.TelegramChallengeResponseRequest)
	}

	if src.UserLoginChallengeResponseRequest != nil {
		return json.Marshal(&src.UserLoginChallengeResponseRequest)
	}

	return nil, nil // no data in oneOf schemas
}

// Get the actual instance
func (obj *FlowChallengeResponseRequest) GetActualInstance() interface{} {
	if obj == nil {
		return nil
	}
	if obj.AppleChallengeResponseRequest != nil {
		return obj.AppleChallengeResponseRequest
	}

	if obj.AuthenticatorDuoChallengeResponseRequest != nil {
		return obj.AuthenticatorDuoChallengeResponseRequest
	}

	if obj.AuthenticatorEmailChallengeResponseRequest != nil {
		return obj.AuthenticatorEmailChallengeResponseRequest
	}

	if obj.AuthenticatorSMSChallengeResponseRequest != nil {
		return obj.AuthenticatorSMSChallengeResponseRequest
	}

	if obj.AuthenticatorStaticChallengeResponseRequest != nil {
		return obj.AuthenticatorStaticChallengeResponseRequest
	}

	if obj.AuthenticatorTOTPChallengeResponseRequest != nil {
		return obj.AuthenticatorTOTPChallengeResponseRequest
	}

	if obj.AuthenticatorValidationChallengeResponseRequest != nil {
		return obj.AuthenticatorValidationChallengeResponseRequest
	}

	if obj.AuthenticatorWebAuthnChallengeResponseRequest != nil {
		return obj.AuthenticatorWebAuthnChallengeResponseRequest
	}

	if obj.AutoSubmitChallengeResponseRequest != nil {
		return obj.AutoSubmitChallengeResponseRequest
	}

	if obj.CaptchaChallengeResponseRequest != nil {
		return obj.CaptchaChallengeResponseRequest
	}

	if obj.ConsentChallengeResponseRequest != nil {
		return obj.ConsentChallengeResponseRequest
	}

	if obj.DummyChallengeResponseRequest != nil {
		return obj.DummyChallengeResponseRequest
	}

	if obj.EmailChallengeResponseRequest != nil {
		return obj.EmailChallengeResponseRequest
	}

	if obj.EndpointAgentChallengeResponseRequest != nil {
		return obj.EndpointAgentChallengeResponseRequest
	}

	if obj.FrameChallengeResponseRequest != nil {
		return obj.FrameChallengeResponseRequest
	}

	if obj.IdentificationChallengeResponseRequest != nil {
		return obj.IdentificationChallengeResponseRequest
	}

	if obj.IframeLogoutChallengeResponseRequest != nil {
		return obj.IframeLogoutChallengeResponseRequest
	}

	if obj.NativeLogoutChallengeResponseRequest != nil {
		return obj.NativeLogoutChallengeResponseRequest
	}

	if obj.OAuthDeviceCodeChallengeResponseRequest != nil {
		return obj.OAuthDeviceCodeChallengeResponseRequest
	}

	if obj.OAuthDeviceCodeFinishChallengeResponseRequest != nil {
		return obj.OAuthDeviceCodeFinishChallengeResponseRequest
	}

	if obj.PasswordChallengeResponseRequest != nil {
		return obj.PasswordChallengeResponseRequest
	}

	if obj.PlexAuthenticationChallengeResponseRequest != nil {
		return obj.PlexAuthenticationChallengeResponseRequest
	}

	if obj.PromptChallengeResponseRequest != nil {
		return obj.PromptChallengeResponseRequest
	}

	if obj.RedirectChallengeResponseRequest != nil {
		return obj.RedirectChallengeResponseRequest
	}

	if obj.TelegramChallengeResponseRequest != nil {
		return obj.TelegramChallengeResponseRequest
	}

	if obj.UserLoginChallengeResponseRequest != nil {
		return obj.UserLoginChallengeResponseRequest
	}

	// all schemas are nil
	return nil
}

// Get the actual instance value
func (obj FlowChallengeResponseRequest) GetActualInstanceValue() interface{} {
	if obj.AppleChallengeResponseRequest != nil {
		return *obj.AppleChallengeResponseRequest
	}

	if obj.AuthenticatorDuoChallengeResponseRequest != nil {
		return *obj.AuthenticatorDuoChallengeResponseRequest
	}

	if obj.AuthenticatorEmailChallengeResponseRequest != nil {
		return *obj.AuthenticatorEmailChallengeResponseRequest
	}

	if obj.AuthenticatorSMSChallengeResponseRequest != nil {
		return *obj.AuthenticatorSMSChallengeResponseRequest
	}

	if obj.AuthenticatorStaticChallengeResponseRequest != nil {
		return *obj.AuthenticatorStaticChallengeResponseRequest
	}

	if obj.AuthenticatorTOTPChallengeResponseRequest != nil {
		return *obj.AuthenticatorTOTPChallengeResponseRequest
	}

	if obj.AuthenticatorValidationChallengeResponseRequest != nil {
		return *obj.AuthenticatorValidationChallengeResponseRequest
	}

	if obj.AuthenticatorWebAuthnChallengeResponseRequest != nil {
		return *obj.AuthenticatorWebAuthnChallengeResponseRequest
	}

	if obj.AutoSubmitChallengeResponseRequest != nil {
		return *obj.AutoSubmitChallengeResponseRequest
	}

	if obj.CaptchaChallengeResponseRequest != nil {
		return *obj.CaptchaChallengeResponseRequest
	}

	if obj.ConsentChallengeResponseRequest != nil {
		return *obj.ConsentChallengeResponseRequest
	}

	if obj.DummyChallengeResponseRequest != nil {
		return *obj.DummyChallengeResponseRequest
	}

	if obj.EmailChallengeResponseRequest != nil {
		return *obj.EmailChallengeResponseRequest
	}

	if obj.EndpointAgentChallengeResponseRequest != nil {
		return *obj.EndpointAgentChallengeResponseRequest
	}

	if obj.FrameChallengeResponseRequest != nil {
		return *obj.FrameChallengeResponseRequest
	}

	if obj.IdentificationChallengeResponseRequest != nil {
		return *obj.IdentificationChallengeResponseRequest
	}

	if obj.IframeLogoutChallengeResponseRequest != nil {
		return *obj.IframeLogoutChallengeResponseRequest
	}

	if obj.NativeLogoutChallengeResponseRequest != nil {
		return *obj.NativeLogoutChallengeResponseRequest
	}

	if obj.OAuthDeviceCodeChallengeResponseRequest != nil {
		return *obj.OAuthDeviceCodeChallengeResponseRequest
	}

	if obj.OAuthDeviceCodeFinishChallengeResponseRequest != nil {
		return *obj.OAuthDeviceCodeFinishChallengeResponseRequest
	}

	if obj.PasswordChallengeResponseRequest != nil {
		return *obj.PasswordChallengeResponseRequest
	}

	if obj.PlexAuthenticationChallengeResponseRequest != nil {
		return *obj.PlexAuthenticationChallengeResponseRequest
	}

	if obj.PromptChallengeResponseRequest != nil {
		return *obj.PromptChallengeResponseRequest
	}

	if obj.RedirectChallengeResponseRequest != nil {
		return *obj.RedirectChallengeResponseRequest
	}

	if obj.TelegramChallengeResponseRequest != nil {
		return *obj.TelegramChallengeResponseRequest
	}

	if obj.UserLoginChallengeResponseRequest != nil {
		return *obj.UserLoginChallengeResponseRequest
	}

	// all schemas are nil
	return nil
}

type NullableFlowChallengeResponseRequest struct {
	value *FlowChallengeResponseRequest
	isSet bool
}

func (v NullableFlowChallengeResponseRequest) Get() *FlowChallengeResponseRequest {
	return v.value
}

func (v *NullableFlowChallengeResponseRequest) Set(val *FlowChallengeResponseRequest) {
	v.value = val
	v.isSet = true
}

func (v NullableFlowChallengeResponseRequest) IsSet() bool {
	return v.isSet
}

func (v *NullableFlowChallengeResponseRequest) Unset() {
	v.value = nil
	v.isSet = false
}

func NewNullableFlowChallengeResponseRequest(val *FlowChallengeResponseRequest) *NullableFlowChallengeResponseRequest {
	return &NullableFlowChallengeResponseRequest{value: val, isSet: true}
}

func (v NullableFlowChallengeResponseRequest) MarshalJSON() ([]byte, error) {
	return json.Marshal(v.value)
}

func (v *NullableFlowChallengeResponseRequest) UnmarshalJSON(src []byte) error {
	v.isSet = true
	return json.Unmarshal(src, &v.value)
}
