import { UseFormReturn } from 'react-hook-form';
import * as Yup from 'yup';
import { FormFieldProps } from 'components/FormField/FormField';
import { RadioGroupOption } from 'components/Inputs/RadioGroup/RadioGroup';
import { RPSliderMarkProps } from 'components/Inputs/Slider/RPSlider';
import { ReactNode, Ref } from 'react';
import { SelectOption, SelectOptionGroup } from 'components/Inputs/Select/Select';
import { GroupBase, SelectInstance } from 'chakra-react-select';
import { StackDirection } from '@chakra-ui/react';
import { TooltipProps } from 'components/Inputs/Slider/chakra/ChakraTooltip';
import { ColumnSelectProps, ColumnSelectOption } from 'components/Inputs/ColumnSelect/ColumnSelect';
export type FormMethods = UseFormReturn<{
    [k: string]: string | number | boolean | string[] | undefined;
}, any>;
type FieldInputMode = 'none' | 'text' | 'tel' | 'url' | 'email' | 'numeric' | 'decimal' | 'search' | 'password';
export interface GenericField extends Omit<FormFieldProps, 'inputMode'> {
    name: string;
    value?: any;
    label: string;
    description?: string | ReactNode;
    footerDescription?: string | ReactNode;
    tooltip?: string | ReactNode;
    defaultValue?: any;
    placeholder?: string;
    help?: string;
    fieldType?: 'text' | 'password' | 'textarea' | 'number' | 'select' | 'radio' | 'hidden' | 'toggle' | 'slider' | 'displaySection' | 'columnSelect' | 'checkbox' | 'custom' | 'repeater';
    isRequired?: boolean;
    isDisabled?: boolean;
    hide?: boolean;
    schema: Yup.Schema;
    columns?: 1 | 2 | 3 | 4 | 5 | 6;
    heading?: string | ReactNode;
    inputMode?: FieldInputMode;
}
export interface TextField extends GenericField {
    schema: Yup.StringSchema<string | undefined, Yup.AnyObject, undefined, ''>;
    pattern?: string;
}
export interface PasswordField extends TextField {
    defaultShowPassword?: boolean;
    showEyeIndicator?: boolean;
}
export interface TextAreaField extends GenericField {
    schema: Yup.StringSchema<string | undefined, Yup.AnyObject, undefined, ''>;
}
export interface NumberField extends GenericField {
    schema: Yup.NumberSchema<number, Yup.AnyObject, undefined, ''>;
    min?: number;
    max?: number;
    step?: number;
}
export interface ColumnSelectField extends GenericField {
    options: ColumnSelectOption[];
    innerRef?: Ref<SelectInstance<SelectOption, boolean, GroupBase<SelectOption>>>;
    isLoading?: boolean;
    headerColumns: ColumnSelectProps['headerColumns'];
    singleValueText?: ColumnSelectProps['singleValueText'];
    firstTextPosition?: ColumnSelectProps['firstTextPosition'];
    footer?: ColumnSelectProps['footer'];
}
export interface SelectField extends GenericField {
    options: SelectOption[] | SelectOptionGroup[];
    isMulti?: boolean;
    innerRef?: Ref<SelectInstance<SelectOption, boolean, GroupBase<SelectOption>>>;
    max?: number;
    isLoading?: boolean;
}
export interface HiddenField extends GenericField {
    schema: Yup.StringSchema<string | undefined, Yup.AnyObject, undefined, ''>;
}
export interface RadioField extends GenericField {
    options: RadioGroupOption[];
    isAttached?: boolean;
    radioVariant?: 'circle' | 'card';
    radioStackDirection?: StackDirection;
}
export interface ToggleField extends GenericField {
    schema: Yup.StringSchema<string, Yup.AnyObject, undefined, ''>;
}
type SliderFieldInputMode = 'none' | 'text' | 'tel' | 'url' | 'email' | 'numeric' | 'decimal' | 'search';
export interface SliderField extends Omit<GenericField, 'inputMode'> {
    schema: Yup.NumberSchema<number, Yup.AnyObject, undefined, ''>;
    min?: number;
    max?: number;
    step?: number;
    marks?: RPSliderMarkProps[];
    sliderTooltip?: Omit<TooltipProps, 'children'>;
    inputMode?: SliderFieldInputMode;
}
export interface DisplaySection extends GenericField {
    schema: Yup.StringSchema<string | undefined, Yup.AnyObject, undefined, ''>;
    fieldType: 'displaySection';
}
export interface CheckboxField extends GenericField {
    schema: Yup.StringSchema<string, Yup.AnyObject, undefined, ''>;
    text: string | ReactNode;
}
export interface RepeaterField extends Omit<GenericField, 'schema'> {
    fieldType: 'repeater';
    schema: Yup.ArraySchema<{
        [key: string]: string;
    }[] | undefined, Yup.AnyObject, '', ''>;
}
export interface CustomFormSection extends Omit<GenericField, 'schema'> {
    fieldType: 'custom';
    fields: CustomField[];
    component: React.ComponentType<CustomFormSectionProps>;
}
export type CustomFormSectionProps = {
    form: UseFormReturn<{
        [x: string]: any;
        [x: number]: any;
    }, any, undefined>;
    setValidationContext?: React.Dispatch<React.SetStateAction<{}>>;
};
export type CustomField = TextField | PasswordField | TextAreaField | NumberField | SelectField | HiddenField | RadioField | ToggleField | SliderField | DisplaySection | ColumnSelectField | CheckboxField | CustomFormSection | RepeaterField;
export {};
