/* tslint:disable */
/* eslint-disable */
/**
 * authentik
 * Making authentication simple.
 *
 * The version of the OpenAPI document: 2026.5.3
 * 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 PatchedFlowStageBindingRequest
 */
export interface PatchedFlowStageBindingRequest {
    /**
     *
     * @type {string}
     * @memberof PatchedFlowStageBindingRequest
     */
    target?: string;
    /**
     *
     * @type {string}
     * @memberof PatchedFlowStageBindingRequest
     */
    stage?: string;
    /**
     * Evaluate policies during the Flow planning process.
     * @type {boolean}
     * @memberof PatchedFlowStageBindingRequest
     */
    evaluateOnPlan?: boolean;
    /**
     * Evaluate policies when the Stage is presented to the user.
     * @type {boolean}
     * @memberof PatchedFlowStageBindingRequest
     */
    reEvaluatePolicies?: boolean;
    /**
     *
     * @type {number}
     * @memberof PatchedFlowStageBindingRequest
     */
    order?: number;
    /**
     *
     * @type {PolicyEngineMode}
     * @memberof PatchedFlowStageBindingRequest
     */
    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 PatchedFlowStageBindingRequest
     */
    invalidResponseAction?: InvalidResponseActionEnum;
}

/**
 * Check if a given object implements the PatchedFlowStageBindingRequest interface.
 */
export function instanceOfPatchedFlowStageBindingRequest(
    value: object,
): value is PatchedFlowStageBindingRequest {
    return true;
}

export function PatchedFlowStageBindingRequestFromJSON(json: any): PatchedFlowStageBindingRequest {
    return PatchedFlowStageBindingRequestFromJSONTyped(json, false);
}

export function PatchedFlowStageBindingRequestFromJSONTyped(
    json: any,
    ignoreDiscriminator: boolean,
): PatchedFlowStageBindingRequest {
    if (json == null) {
        return json;
    }
    return {
        target: json["target"] == null ? undefined : json["target"],
        stage: json["stage"] == null ? undefined : 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"] == null ? undefined : 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 PatchedFlowStageBindingRequestToJSON(json: any): PatchedFlowStageBindingRequest {
    return PatchedFlowStageBindingRequestToJSONTyped(json, false);
}

export function PatchedFlowStageBindingRequestToJSONTyped(
    value?: PatchedFlowStageBindingRequest | 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"]),
    };
}
