import { ComponentModel } from "../component.model";
import { SchemaValidatorBodyModel } from "../../../features/validator/models/joi-validators.model";
/**
 * Represents the configuration for a form component.
 * Extends the `ComponentModel` interface to include additional properties
 * specific to form behavior and validation.
 * example:
 *  {
 *   type: 'form',
 *  validatorSchema: {},
 *  onSubmit: {
 *              method: 'POST',
 *              action: '/submit',
 *              target: '_self',
 *              novalidate: false
 *            }
 */
export interface FormComponentModel extends ComponentModel {
    /**
     * The schema used for validating the form data.
     */
    validatorSchema: SchemaValidatorBodyModel;
    /**
     * Configuration for the form submission behavior.
     */
    onSubmit?: {
        /**
         * The HTTP method to use when submitting the form.
         * Can be one of 'GET', 'POST', 'PUT', or 'PATCH'.
         */
        method?: 'GET' | 'POST' | 'PUT' | 'PATCH';
        /**
         * The URL or endpoint to which the form data should be submitted.
         */
        action?: string;
        /**
         * Specifies where to display the response after submitting the form.
         * Can be '_self', '_blank', or '_parent'.
         */
        target?: '_self' | '_blank' | '_parent';
        /**
         * Indicates whether the form should bypass HTML5 validation before submission.
         * If true, the form will not be validated.
         */
        novalidate?: boolean;
    };
}
