/* 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 { InvalidResponseActionEnum } from "./InvalidResponseActionEnum";
import {
    InvalidResponseActionEnumFromJSON,
    InvalidResponseActionEnumToJSON,
} from "./InvalidResponseActionEnum";
import type { PolicyEngineMode } from "./PolicyEngineMode";
import { PolicyEngineModeFromJSON, PolicyEngineModeToJSON } from "./PolicyEngineMode";

/**
 * FlowStageBinding Serializer
 * @export
 * @interface FlowStageBindingRequest
 */
export interface FlowStageBindingRequest {
    /**
     *
     * @type {string}
     * @memberof FlowStageBindingRequest
     */
    target: string;
    /**
     *
     * @type {string}
     * @memberof FlowStageBindingRequest
     */
    stage: string;
    /**
     * Evaluate policies during the Flow planning process.
     * @type {boolean}
     * @memberof FlowStageBindingRequest
     */
    evaluateOnPlan?: boolean;
    /**
     * Evaluate policies when the Stage is presented to the user.
     * @type {boolean}
     * @memberof FlowStageBindingRequest
     */
    reEvaluatePolicies?: boolean;
    /**
     *
     * @type {number}
     * @memberof FlowStageBindingRequest
     */
    order: number;
    /**
     *
     * @type {PolicyEngineMode}
     * @memberof FlowStageBindingRequest
     */
    policyEngineMode?: PolicyEngineMode;
    /**
     * Configure how the flow executor should handle an invalid response to a challenge. RETRY returns the error message and a similar challenge to the executor. RESTART restarts the flow from the beginning, and RESTART_WITH_CONTEXT restarts the flow while keeping the current context.
     * @type {InvalidResponseActionEnum}
     * @memberof FlowStageBindingRequest
     */
    invalidResponseAction?: InvalidResponseActionEnum;
}

/**
 * Check if a given object implements the FlowStageBindingRequest interface.
 */
export function instanceOfFlowStageBindingRequest(value: object): value is FlowStageBindingRequest {
    if (!("target" in value) || value["target"] === undefined) return false;
    if (!("stage" in value) || value["stage"] === undefined) return false;
    if (!("order" in value) || value["order"] === undefined) return false;
    return true;
}

export function FlowStageBindingRequestFromJSON(json: any): FlowStageBindingRequest {
    return FlowStageBindingRequestFromJSONTyped(json, false);
}

export function FlowStageBindingRequestFromJSONTyped(
    json: any,
    ignoreDiscriminator: boolean,
): FlowStageBindingRequest {
    if (json == null) {
        return json;
    }
    return {
        target: json["target"],
        stage: json["stage"],
        evaluateOnPlan: json["evaluate_on_plan"] == null ? undefined : json["evaluate_on_plan"],
        reEvaluatePolicies:
            json["re_evaluate_policies"] == null ? undefined : json["re_evaluate_policies"],
        order: json["order"],
        policyEngineMode:
            json["policy_engine_mode"] == null
                ? undefined
                : PolicyEngineModeFromJSON(json["policy_engine_mode"]),
        invalidResponseAction:
            json["invalid_response_action"] == null
                ? undefined
                : InvalidResponseActionEnumFromJSON(json["invalid_response_action"]),
    };
}

export function FlowStageBindingRequestToJSON(json: any): FlowStageBindingRequest {
    return FlowStageBindingRequestToJSONTyped(json, false);
}

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

    return {
        target: value["target"],
        stage: value["stage"],
        evaluate_on_plan: value["evaluateOnPlan"],
        re_evaluate_policies: value["reEvaluatePolicies"],
        order: value["order"],
        policy_engine_mode: PolicyEngineModeToJSON(value["policyEngineMode"]),
        invalid_response_action: InvalidResponseActionEnumToJSON(value["invalidResponseAction"]),
    };
}
