/* 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";

/**
 * Challenge for ending a session
 * @export
 * @interface SessionEndChallenge
 */
export interface SessionEndChallenge {
    /**
     *
     * @type {ContextualFlowInfo}
     * @memberof SessionEndChallenge
     */
    flowInfo?: ContextualFlowInfo;
    /**
     *
     * @type {string}
     * @memberof SessionEndChallenge
     */
    component?: string;
    /**
     *
     * @type {{ [key: string]: Array<ErrorDetail>; }}
     * @memberof SessionEndChallenge
     */
    responseErrors?: { [key: string]: Array<ErrorDetail> };
    /**
     *
     * @type {string}
     * @memberof SessionEndChallenge
     */
    pendingUser: string;
    /**
     *
     * @type {string}
     * @memberof SessionEndChallenge
     */
    pendingUserAvatar: string;
    /**
     *
     * @type {string}
     * @memberof SessionEndChallenge
     */
    applicationName?: string;
    /**
     *
     * @type {string}
     * @memberof SessionEndChallenge
     */
    applicationLaunchUrl?: string;
    /**
     *
     * @type {string}
     * @memberof SessionEndChallenge
     */
    invalidationFlowUrl?: string;
    /**
     *
     * @type {string}
     * @memberof SessionEndChallenge
     */
    brandName: string;
}

/**
 * Check if a given object implements the SessionEndChallenge interface.
 */
export function instanceOfSessionEndChallenge(value: object): value is SessionEndChallenge {
    if (!("pendingUser" in value) || value["pendingUser"] === undefined) return false;
    if (!("pendingUserAvatar" in value) || value["pendingUserAvatar"] === undefined) return false;
    if (!("brandName" in value) || value["brandName"] === undefined) return false;
    return true;
}

export function SessionEndChallengeFromJSON(json: any): SessionEndChallenge {
    return SessionEndChallengeFromJSONTyped(json, false);
}

export function SessionEndChallengeFromJSONTyped(
    json: any,
    ignoreDiscriminator: boolean,
): SessionEndChallenge {
    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"],
        pendingUser: json["pending_user"],
        pendingUserAvatar: json["pending_user_avatar"],
        applicationName: json["application_name"] == null ? undefined : json["application_name"],
        applicationLaunchUrl:
            json["application_launch_url"] == null ? undefined : json["application_launch_url"],
        invalidationFlowUrl:
            json["invalidation_flow_url"] == null ? undefined : json["invalidation_flow_url"],
        brandName: json["brand_name"],
    };
}

export function SessionEndChallengeToJSON(json: any): SessionEndChallenge {
    return SessionEndChallengeToJSONTyped(json, false);
}

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

    return {
        flow_info: ContextualFlowInfoToJSON(value["flowInfo"]),
        component: value["component"],
        response_errors: value["responseErrors"],
        pending_user: value["pendingUser"],
        pending_user_avatar: value["pendingUserAvatar"],
        application_name: value["applicationName"],
        application_launch_url: value["applicationLaunchUrl"],
        invalidation_flow_url: value["invalidationFlowUrl"],
        brand_name: value["brandName"],
    };
}
