/* tslint:disable */
/* eslint-disable */
/**
 * authentik
 * Making authentication simple.
 *
 * The version of the OpenAPI document: 2026.5.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 { ContextualFlowInfo } from "./ContextualFlowInfo";
import { ContextualFlowInfoFromJSON, ContextualFlowInfoToJSON } from "./ContextualFlowInfo";
import type { ErrorDetail } from "./ErrorDetail";

/**
 * Special challenge for apple-native authentication flow, which happens on the client.
 * @export
 * @interface AppleLoginChallenge
 */
export interface AppleLoginChallenge {
    /**
     *
     * @type {ContextualFlowInfo}
     * @memberof AppleLoginChallenge
     */
    flowInfo?: ContextualFlowInfo;
    /**
     *
     * @type {string}
     * @memberof AppleLoginChallenge
     */
    component?: string;
    /**
     *
     * @type {{ [key: string]: Array<ErrorDetail>; }}
     * @memberof AppleLoginChallenge
     */
    responseErrors?: { [key: string]: Array<ErrorDetail> };
    /**
     *
     * @type {string}
     * @memberof AppleLoginChallenge
     */
    clientId: string;
    /**
     *
     * @type {string}
     * @memberof AppleLoginChallenge
     */
    scope: string;
    /**
     *
     * @type {string}
     * @memberof AppleLoginChallenge
     */
    redirectUri: string;
    /**
     *
     * @type {string}
     * @memberof AppleLoginChallenge
     */
    state: string;
}

/**
 * Check if a given object implements the AppleLoginChallenge interface.
 */
export function instanceOfAppleLoginChallenge(value: object): value is AppleLoginChallenge {
    if (!("clientId" in value) || value["clientId"] === undefined) return false;
    if (!("scope" in value) || value["scope"] === undefined) return false;
    if (!("redirectUri" in value) || value["redirectUri"] === undefined) return false;
    if (!("state" in value) || value["state"] === undefined) return false;
    return true;
}

export function AppleLoginChallengeFromJSON(json: any): AppleLoginChallenge {
    return AppleLoginChallengeFromJSONTyped(json, false);
}

export function AppleLoginChallengeFromJSONTyped(
    json: any,
    ignoreDiscriminator: boolean,
): AppleLoginChallenge {
    if (json == null) {
        return json;
    }
    return {
        flowInfo:
            json["flow_info"] == null ? undefined : ContextualFlowInfoFromJSON(json["flow_info"]),
        component: json["component"] == null ? undefined : json["component"],
        responseErrors: json["response_errors"] == null ? undefined : json["response_errors"],
        clientId: json["client_id"],
        scope: json["scope"],
        redirectUri: json["redirect_uri"],
        state: json["state"],
    };
}

export function AppleLoginChallengeToJSON(json: any): AppleLoginChallenge {
    return AppleLoginChallengeToJSONTyped(json, false);
}

export function AppleLoginChallengeToJSONTyped(
    value?: AppleLoginChallenge | null,
    ignoreDiscriminator: boolean = false,
): any {
    if (value == null) {
        return value;
    }

    return {
        flow_info: ContextualFlowInfoToJSON(value["flowInfo"]),
        component: value["component"],
        response_errors: value["responseErrors"],
        client_id: value["clientId"],
        scope: value["scope"],
        redirect_uri: value["redirectUri"],
        state: value["state"],
    };
}
