import { ButtonElement } from "../InteractiveElements/index";
import { ElementEntity } from "../InteractiveEntities/ElementEntity";
/**
 * Represents the data of an interactive form.
 */
export class InteractiveFormData {
    /**
     * The title of the form.
     */
    title;
    /**
     * The goal completion text of the form.
     */
    goalCompletionText;
    /**
     * The form fields of the form.
     */
    formFields;
    /**
     * The submit button of the form.
     */
    submitElement;
    /**
     * Creates a new instance of InteractiveFormData.
     * @param title - The title of the form.
     * @param formFields - The form fields of the form.
     * @param submitElement - The submit button of the form.
     */
    constructor(title, formFields, submitElement) {
        this.title = title || "";
        this.formFields = formFields || [];
        this.submitElement = submitElement;
    }
    /**
     * Returns the form fields of the form.
     * @returns An array of form fields.
     */
    getFormFields() {
        return this.formFields;
    }
    /**
     * Returns the title of the form.
     * @returns The title of the form.
     */
    getTitle() {
        return this.title;
    }
    /**
     * Returns the submit button of the form.
     * @returns The submit button of the form.
     */
    getSubmitElement() {
        return this.submitElement;
    }
    /**
     * Returns the goal completion text of the form.
     * @returns The goal completion text of the form.
     */
    getGoalCompletionText() {
        return this.goalCompletionText;
    }
    /**
     * Sets the goal completion text of the form.
     * @param goalCompletionText - The goal completion text of the form.
     */
    setGoalCompletionText(goalCompletionText) {
        this.goalCompletionText = goalCompletionText;
    }
    static fromJSON(json) {
        const formFields = (json?.formFields || []).map((field) => {
            return ElementEntity.fromJSON(field);
        });
        const submitElement = ButtonElement.fromJSON(json.submitElement);
        const interactiveFormData = new InteractiveFormData(json.title, formFields, submitElement);
        if (json.goalCompletionText)
            interactiveFormData.setGoalCompletionText(json.goalCompletionText);
        return interactiveFormData;
    }
}
//# sourceMappingURL=InteractiveFormData.js.map