/* 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 { 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";

/**
 * Stripped down flow serializer
 * @export
 * @interface FlowSet
 */
export interface FlowSet {
    /**
     *
     * @type {string}
     * @memberof FlowSet
     */
    readonly pk: string;
    /**
     *
     * @type {string}
     * @memberof FlowSet
     */
    readonly policybindingmodelPtrId: string;
    /**
     *
     * @type {string}
     * @memberof FlowSet
     */
    name: string;
    /**
     * Visible in the URL.
     * @type {string}
     * @memberof FlowSet
     */
    slug: string;
    /**
     * Shown as the Title in Flow pages.
     * @type {string}
     * @memberof FlowSet
     */
    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 FlowSet
     */
    designation: FlowDesignationEnum;
    /**
     * Get the URL to the background image
     * @type {string}
     * @memberof FlowSet
     */
    readonly backgroundUrl: string;
    /**
     *
     * @type {PolicyEngineMode}
     * @memberof FlowSet
     */
    policyEngineMode?: PolicyEngineMode;
    /**
     * Enable compatibility mode, increases compatibility with password managers on mobile devices.
     * @type {boolean}
     * @memberof FlowSet
     */
    compatibilityMode?: boolean;
    /**
     * Get export URL for flow
     * @type {string}
     * @memberof FlowSet
     */
    readonly exportUrl: string;
    /**
     *
     * @type {FlowLayoutEnum}
     * @memberof FlowSet
     */
    layout?: FlowLayoutEnum;
    /**
     * Configure what should happen when a flow denies access to a user.
     * @type {DeniedActionEnum}
     * @memberof FlowSet
     */
    deniedAction?: DeniedActionEnum;
}

/**
 * Check if a given object implements the FlowSet interface.
 */
export function instanceOfFlowSet(value: object): value is FlowSet {
    if (!("pk" in value) || value["pk"] === undefined) return false;
    if (!("policybindingmodelPtrId" in value) || value["policybindingmodelPtrId"] === undefined)
        return false;
    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;
    if (!("backgroundUrl" in value) || value["backgroundUrl"] === undefined) return false;
    if (!("exportUrl" in value) || value["exportUrl"] === undefined) return false;
    return true;
}

export function FlowSetFromJSON(json: any): FlowSet {
    return FlowSetFromJSONTyped(json, false);
}

export function FlowSetFromJSONTyped(json: any, ignoreDiscriminator: boolean): FlowSet {
    if (json == null) {
        return json;
    }
    return {
        pk: json["pk"],
        policybindingmodelPtrId: json["policybindingmodel_ptr_id"],
        name: json["name"],
        slug: json["slug"],
        title: json["title"],
        designation: FlowDesignationEnumFromJSON(json["designation"]),
        backgroundUrl: json["background_url"],
        policyEngineMode:
            json["policy_engine_mode"] == null
                ? undefined
                : PolicyEngineModeFromJSON(json["policy_engine_mode"]),
        compatibilityMode:
            json["compatibility_mode"] == null ? undefined : json["compatibility_mode"],
        exportUrl: json["export_url"],
        layout: json["layout"] == null ? undefined : FlowLayoutEnumFromJSON(json["layout"]),
        deniedAction:
            json["denied_action"] == null
                ? undefined
                : DeniedActionEnumFromJSON(json["denied_action"]),
    };
}

export function FlowSetToJSON(json: any): FlowSet {
    return FlowSetToJSONTyped(json, false);
}

export function FlowSetToJSONTyped(
    value?: Omit<
        FlowSet,
        "pk" | "policybindingmodel_ptr_id" | "background_url" | "export_url"
    > | null,
    ignoreDiscriminator: boolean = false,
): any {
    if (value == null) {
        return value;
    }

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