/* 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 { AuthenticationEnum } from "./AuthenticationEnum";
import { AuthenticationEnumFromJSON, AuthenticationEnumToJSON } from "./AuthenticationEnum";
import type { DeniedActionEnum } from "./DeniedActionEnum";
import { DeniedActionEnumFromJSON, DeniedActionEnumToJSON } from "./DeniedActionEnum";
import type { FlowDesignationEnum } from "./FlowDesignationEnum";
import { FlowDesignationEnumFromJSON, FlowDesignationEnumToJSON } from "./FlowDesignationEnum";
import type { FlowLayoutEnum } from "./FlowLayoutEnum";
import { FlowLayoutEnumFromJSON, FlowLayoutEnumToJSON } from "./FlowLayoutEnum";
import type { PolicyEngineMode } from "./PolicyEngineMode";
import { PolicyEngineModeFromJSON, PolicyEngineModeToJSON } from "./PolicyEngineMode";

/**
 * Flow Serializer
 * @export
 * @interface FlowRequest
 */
export interface FlowRequest {
    /**
     *
     * @type {string}
     * @memberof FlowRequest
     */
    name: string;
    /**
     * Visible in the URL.
     * @type {string}
     * @memberof FlowRequest
     */
    slug: string;
    /**
     * Shown as the Title in Flow pages.
     * @type {string}
     * @memberof FlowRequest
     */
    title: string;
    /**
     * Decides what this Flow is used for. For example, the Authentication flow is redirect to when an un-authenticated user visits authentik.
     * @type {FlowDesignationEnum}
     * @memberof FlowRequest
     */
    designation: FlowDesignationEnum;
    /**
     * Background shown during execution
     * @type {string}
     * @memberof FlowRequest
     */
    background?: string;
    /**
     *
     * @type {PolicyEngineMode}
     * @memberof FlowRequest
     */
    policyEngineMode?: PolicyEngineMode;
    /**
     * Enable compatibility mode, increases compatibility with password managers on mobile devices.
     * @type {boolean}
     * @memberof FlowRequest
     */
    compatibilityMode?: boolean;
    /**
     *
     * @type {FlowLayoutEnum}
     * @memberof FlowRequest
     */
    layout?: FlowLayoutEnum;
    /**
     * Configure what should happen when a flow denies access to a user.
     * @type {DeniedActionEnum}
     * @memberof FlowRequest
     */
    deniedAction?: DeniedActionEnum;
    /**
     * Required level of authentication and authorization to access a flow.
     * @type {AuthenticationEnum}
     * @memberof FlowRequest
     */
    authentication?: AuthenticationEnum;
}

/**
 * Check if a given object implements the FlowRequest interface.
 */
export function instanceOfFlowRequest(value: object): value is FlowRequest {
    if (!("name" in value) || value["name"] === undefined) return false;
    if (!("slug" in value) || value["slug"] === undefined) return false;
    if (!("title" in value) || value["title"] === undefined) return false;
    if (!("designation" in value) || value["designation"] === undefined) return false;
    return true;
}

export function FlowRequestFromJSON(json: any): FlowRequest {
    return FlowRequestFromJSONTyped(json, false);
}

export function FlowRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): FlowRequest {
    if (json == null) {
        return json;
    }
    return {
        name: json["name"],
        slug: json["slug"],
        title: json["title"],
        designation: FlowDesignationEnumFromJSON(json["designation"]),
        background: json["background"] == null ? undefined : json["background"],
        policyEngineMode:
            json["policy_engine_mode"] == null
                ? undefined
                : PolicyEngineModeFromJSON(json["policy_engine_mode"]),
        compatibilityMode:
            json["compatibility_mode"] == null ? undefined : json["compatibility_mode"],
        layout: json["layout"] == null ? undefined : FlowLayoutEnumFromJSON(json["layout"]),
        deniedAction:
            json["denied_action"] == null
                ? undefined
                : DeniedActionEnumFromJSON(json["denied_action"]),
        authentication:
            json["authentication"] == null
                ? undefined
                : AuthenticationEnumFromJSON(json["authentication"]),
    };
}

export function FlowRequestToJSON(json: any): FlowRequest {
    return FlowRequestToJSONTyped(json, false);
}

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

    return {
        name: value["name"],
        slug: value["slug"],
        title: value["title"],
        designation: FlowDesignationEnumToJSON(value["designation"]),
        background: value["background"],
        policy_engine_mode: PolicyEngineModeToJSON(value["policyEngineMode"]),
        compatibility_mode: value["compatibilityMode"],
        layout: FlowLayoutEnumToJSON(value["layout"]),
        denied_action: DeniedActionEnumToJSON(value["deniedAction"]),
        authentication: AuthenticationEnumToJSON(value["authentication"]),
    };
}
