/* 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 shown to the user in identification stage
 * @export
 * @interface PlexAuthenticationChallenge
 */
export interface PlexAuthenticationChallenge {
    /**
     *
     * @type {ContextualFlowInfo}
     * @memberof PlexAuthenticationChallenge
     */
    flowInfo?: ContextualFlowInfo;
    /**
     *
     * @type {string}
     * @memberof PlexAuthenticationChallenge
     */
    component?: string;
    /**
     *
     * @type {{ [key: string]: Array<ErrorDetail>; }}
     * @memberof PlexAuthenticationChallenge
     */
    responseErrors?: { [key: string]: Array<ErrorDetail> };
    /**
     *
     * @type {string}
     * @memberof PlexAuthenticationChallenge
     */
    clientId: string;
    /**
     *
     * @type {string}
     * @memberof PlexAuthenticationChallenge
     */
    slug: string;
}

/**
 * Check if a given object implements the PlexAuthenticationChallenge interface.
 */
export function instanceOfPlexAuthenticationChallenge(
    value: object,
): value is PlexAuthenticationChallenge {
    if (!("clientId" in value) || value["clientId"] === undefined) return false;
    if (!("slug" in value) || value["slug"] === undefined) return false;
    return true;
}

export function PlexAuthenticationChallengeFromJSON(json: any): PlexAuthenticationChallenge {
    return PlexAuthenticationChallengeFromJSONTyped(json, false);
}

export function PlexAuthenticationChallengeFromJSONTyped(
    json: any,
    ignoreDiscriminator: boolean,
): PlexAuthenticationChallenge {
    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"],
        slug: json["slug"],
    };
}

export function PlexAuthenticationChallengeToJSON(json: any): PlexAuthenticationChallenge {
    return PlexAuthenticationChallengeToJSONTyped(json, false);
}

export function PlexAuthenticationChallengeToJSONTyped(
    value?: PlexAuthenticationChallenge | 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"],
        slug: value["slug"],
    };
}
