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

/**
 * Prompt Serializer
 * @export
 * @interface PromptRequest
 */
export interface PromptRequest {
    /**
     *
     * @type {string}
     * @memberof PromptRequest
     */
    name: string;
    /**
     * Name of the form field, also used to store the value
     * @type {string}
     * @memberof PromptRequest
     */
    fieldKey: string;
    /**
     *
     * @type {string}
     * @memberof PromptRequest
     */
    label: string;
    /**
     *
     * @type {PromptTypeEnum}
     * @memberof PromptRequest
     */
    type: PromptTypeEnum;
    /**
     *
     * @type {boolean}
     * @memberof PromptRequest
     */
    required?: boolean;
    /**
     * Optionally provide a short hint that describes the expected input value. When creating a fixed choice field, enable interpreting as expression and return a list to return multiple choices.
     * @type {string}
     * @memberof PromptRequest
     */
    placeholder?: string;
    /**
     * Optionally pre-fill the input with an initial value. When creating a fixed choice field, enable interpreting as expression and return a list to return multiple default choices.
     * @type {string}
     * @memberof PromptRequest
     */
    initialValue?: string;
    /**
     *
     * @type {number}
     * @memberof PromptRequest
     */
    order?: number;
    /**
     *
     * @type {string}
     * @memberof PromptRequest
     */
    subText?: string;
    /**
     *
     * @type {boolean}
     * @memberof PromptRequest
     */
    placeholderExpression?: boolean;
    /**
     *
     * @type {boolean}
     * @memberof PromptRequest
     */
    initialValueExpression?: boolean;
}

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

export function PromptRequestFromJSON(json: any): PromptRequest {
    return PromptRequestFromJSONTyped(json, false);
}

export function PromptRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): PromptRequest {
    if (json == null) {
        return json;
    }
    return {
        name: json["name"],
        fieldKey: json["field_key"],
        label: json["label"],
        type: PromptTypeEnumFromJSON(json["type"]),
        required: json["required"] == null ? undefined : json["required"],
        placeholder: json["placeholder"] == null ? undefined : json["placeholder"],
        initialValue: json["initial_value"] == null ? undefined : json["initial_value"],
        order: json["order"] == null ? undefined : json["order"],
        subText: json["sub_text"] == null ? undefined : json["sub_text"],
        placeholderExpression:
            json["placeholder_expression"] == null ? undefined : json["placeholder_expression"],
        initialValueExpression:
            json["initial_value_expression"] == null ? undefined : json["initial_value_expression"],
    };
}

export function PromptRequestToJSON(json: any): PromptRequest {
    return PromptRequestToJSONTyped(json, false);
}

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

    return {
        name: value["name"],
        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"],
        placeholder_expression: value["placeholderExpression"],
        initial_value_expression: value["initialValueExpression"],
    };
}
