/* tslint:disable */
/* eslint-disable */
/**
 * authentik
 * Making authentication simple.
 *
 * The version of the OpenAPI document: 2025.10.0-rc1
 * Contact: hello@goauthentik.io
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

import type { AppleLoginChallenge } from './AppleLoginChallenge';
import {
    instanceOfAppleLoginChallenge,
    AppleLoginChallengeFromJSON,
    AppleLoginChallengeFromJSONTyped,
    AppleLoginChallengeToJSON,
} from './AppleLoginChallenge';
import type { PlexAuthenticationChallenge } from './PlexAuthenticationChallenge';
import {
    instanceOfPlexAuthenticationChallenge,
    PlexAuthenticationChallengeFromJSON,
    PlexAuthenticationChallengeFromJSONTyped,
    PlexAuthenticationChallengeToJSON,
} from './PlexAuthenticationChallenge';
import type { RedirectChallenge } from './RedirectChallenge';
import {
    instanceOfRedirectChallenge,
    RedirectChallengeFromJSON,
    RedirectChallengeFromJSONTyped,
    RedirectChallengeToJSON,
} from './RedirectChallenge';

/**
 * @type LoginChallengeTypes
 * 
 * @export
 */
export type LoginChallengeTypes = { component: 'ak-source-oauth-apple' } & AppleLoginChallenge | { component: 'ak-source-plex' } & PlexAuthenticationChallenge | { component: 'xak-flow-redirect' } & RedirectChallenge;

export function LoginChallengeTypesFromJSON(json: any): LoginChallengeTypes {
    return LoginChallengeTypesFromJSONTyped(json, false);
}

export function LoginChallengeTypesFromJSONTyped(json: any, ignoreDiscriminator: boolean): LoginChallengeTypes {
    if (json == null) {
        return json;
    }
    switch (json['component']) {
        case 'ak-source-oauth-apple':
            return Object.assign({}, AppleLoginChallengeFromJSONTyped(json, true), { component: 'ak-source-oauth-apple' } as const);
        case 'ak-source-plex':
            return Object.assign({}, PlexAuthenticationChallengeFromJSONTyped(json, true), { component: 'ak-source-plex' } as const);
        case 'xak-flow-redirect':
            return Object.assign({}, RedirectChallengeFromJSONTyped(json, true), { component: 'xak-flow-redirect' } as const);
        default:
            return json;
    }
}

export function LoginChallengeTypesToJSON(json: any): any {
    return LoginChallengeTypesToJSONTyped(json, false);
}

export function LoginChallengeTypesToJSONTyped(value?: LoginChallengeTypes | null, ignoreDiscriminator: boolean = false): any {
    if (value == null) {
        return value;
    }
    switch (value['component']) {
        case 'ak-source-oauth-apple':
            return Object.assign({}, AppleLoginChallengeToJSON(value), { component: 'ak-source-oauth-apple' } as const);
        case 'ak-source-plex':
            return Object.assign({}, PlexAuthenticationChallengeToJSON(value), { component: 'ak-source-plex' } as const);
        case 'xak-flow-redirect':
            return Object.assign({}, RedirectChallengeToJSON(value), { component: 'xak-flow-redirect' } as const);
        default:
            return value;
    }
}

