/* 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 { PromptChoice } from "./PromptChoice";
import { PromptChoiceFromJSON, PromptChoiceToJSON } from "./PromptChoice";
import type { PromptTypeEnum } from "./PromptTypeEnum";
import { PromptTypeEnumFromJSON, PromptTypeEnumToJSON } from "./PromptTypeEnum";

/**
 * Serializer for a single Prompt field
 * @export
 * @interface StagePrompt
 */
export interface StagePrompt {
    /**
     *
     * @type {string}
     * @memberof StagePrompt
     */
    fieldKey: string;
    /**
     *
     * @type {string}
     * @memberof StagePrompt
     */
    label: string;
    /**
     *
     * @type {PromptTypeEnum}
     * @memberof StagePrompt
     */
    type: PromptTypeEnum;
    /**
     *
     * @type {boolean}
     * @memberof StagePrompt
     */
    required: boolean;
    /**
     *
     * @type {string}
     * @memberof StagePrompt
     */
    placeholder: string;
    /**
     *
     * @type {string}
     * @memberof StagePrompt
     */
    initialValue: string;
    /**
     *
     * @type {number}
     * @memberof StagePrompt
     */
    order: number;
    /**
     *
     * @type {string}
     * @memberof StagePrompt
     */
    subText: string;
    /**
     *
     * @type {Array<PromptChoice>}
     * @memberof StagePrompt
     */
    choices: Array<PromptChoice> | null;
}

/**
 * Check if a given object implements the StagePrompt interface.
 */
export function instanceOfStagePrompt(value: object): value is StagePrompt {
    if (!("fieldKey" in value) || value["fieldKey"] === undefined) return false;
    if (!("label" in value) || value["label"] === undefined) return false;
    if (!("type" in value) || value["type"] === undefined) return false;
    if (!("required" in value) || value["required"] === undefined) return false;
    if (!("placeholder" in value) || value["placeholder"] === undefined) return false;
    if (!("initialValue" in value) || value["initialValue"] === undefined) return false;
    if (!("order" in value) || value["order"] === undefined) return false;
    if (!("subText" in value) || value["subText"] === undefined) return false;
    if (!("choices" in value) || value["choices"] === undefined) return false;
    return true;
}

export function StagePromptFromJSON(json: any): StagePrompt {
    return StagePromptFromJSONTyped(json, false);
}

export function StagePromptFromJSONTyped(json: any, ignoreDiscriminator: boolean): StagePrompt {
    if (json == null) {
        return json;
    }
    return {
        fieldKey: json["field_key"],
        label: json["label"],
        type: PromptTypeEnumFromJSON(json["type"]),
        required: json["required"],
        placeholder: json["placeholder"],
        initialValue: json["initial_value"],
        order: json["order"],
        subText: json["sub_text"],
        choices:
            json["choices"] == null
                ? null
                : (json["choices"] as Array<any>).map(PromptChoiceFromJSON),
    };
}

export function StagePromptToJSON(json: any): StagePrompt {
    return StagePromptToJSONTyped(json, false);
}

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

    return {
        field_key: value["fieldKey"],
        label: value["label"],
        type: PromptTypeEnumToJSON(value["type"]),
        required: value["required"],
        placeholder: value["placeholder"],
        initial_value: value["initialValue"],
        order: value["order"],
        sub_text: value["subText"],
        choices:
            value["choices"] == null
                ? null
                : (value["choices"] as Array<any>).map(PromptChoiceToJSON),
    };
}
