/* 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 { FlowSet } from "./FlowSet";
import { FlowSetFromJSON } from "./FlowSet";
import type { RedirectStageModeEnum } from "./RedirectStageModeEnum";
import {
    RedirectStageModeEnumFromJSON,
    RedirectStageModeEnumToJSON,
} from "./RedirectStageModeEnum";

/**
 * RedirectStage Serializer
 * @export
 * @interface RedirectStage
 */
export interface RedirectStage {
    /**
     *
     * @type {string}
     * @memberof RedirectStage
     */
    readonly pk: string;
    /**
     *
     * @type {string}
     * @memberof RedirectStage
     */
    name: string;
    /**
     * Get object type so that we know how to edit the object
     * @type {string}
     * @memberof RedirectStage
     */
    readonly component: string;
    /**
     * Return object's verbose_name
     * @type {string}
     * @memberof RedirectStage
     */
    readonly verboseName: string;
    /**
     * Return object's plural verbose_name
     * @type {string}
     * @memberof RedirectStage
     */
    readonly verboseNamePlural: string;
    /**
     * Return internal model name
     * @type {string}
     * @memberof RedirectStage
     */
    readonly metaModelName: string;
    /**
     *
     * @type {Array<FlowSet>}
     * @memberof RedirectStage
     */
    readonly flowSet: Array<FlowSet>;
    /**
     *
     * @type {boolean}
     * @memberof RedirectStage
     */
    keepContext?: boolean;
    /**
     *
     * @type {RedirectStageModeEnum}
     * @memberof RedirectStage
     */
    mode: RedirectStageModeEnum;
    /**
     *
     * @type {string}
     * @memberof RedirectStage
     */
    targetStatic?: string;
    /**
     *
     * @type {string}
     * @memberof RedirectStage
     */
    targetFlow?: string | null;
}

/**
 * Check if a given object implements the RedirectStage interface.
 */
export function instanceOfRedirectStage(value: object): value is RedirectStage {
    if (!("pk" in value) || value["pk"] === undefined) return false;
    if (!("name" in value) || value["name"] === undefined) return false;
    if (!("component" in value) || value["component"] === undefined) return false;
    if (!("verboseName" in value) || value["verboseName"] === undefined) return false;
    if (!("verboseNamePlural" in value) || value["verboseNamePlural"] === undefined) return false;
    if (!("metaModelName" in value) || value["metaModelName"] === undefined) return false;
    if (!("flowSet" in value) || value["flowSet"] === undefined) return false;
    if (!("mode" in value) || value["mode"] === undefined) return false;
    return true;
}

export function RedirectStageFromJSON(json: any): RedirectStage {
    return RedirectStageFromJSONTyped(json, false);
}

export function RedirectStageFromJSONTyped(json: any, ignoreDiscriminator: boolean): RedirectStage {
    if (json == null) {
        return json;
    }
    return {
        pk: json["pk"],
        name: json["name"],
        component: json["component"],
        verboseName: json["verbose_name"],
        verboseNamePlural: json["verbose_name_plural"],
        metaModelName: json["meta_model_name"],
        flowSet: (json["flow_set"] as Array<any>).map(FlowSetFromJSON),
        keepContext: json["keep_context"] == null ? undefined : json["keep_context"],
        mode: RedirectStageModeEnumFromJSON(json["mode"]),
        targetStatic: json["target_static"] == null ? undefined : json["target_static"],
        targetFlow: json["target_flow"] == null ? undefined : json["target_flow"],
    };
}

export function RedirectStageToJSON(json: any): RedirectStage {
    return RedirectStageToJSONTyped(json, false);
}

export function RedirectStageToJSONTyped(
    value?: Omit<
        RedirectStage,
        "pk" | "component" | "verbose_name" | "verbose_name_plural" | "meta_model_name" | "flow_set"
    > | null,
    ignoreDiscriminator: boolean = false,
): any {
    if (value == null) {
        return value;
    }

    return {
        name: value["name"],
        keep_context: value["keepContext"],
        mode: RedirectStageModeEnumToJSON(value["mode"]),
        target_static: value["targetStatic"],
        target_flow: value["targetFlow"],
    };
}
