import { VComponent } from './component'

export const Richform: VComponent<RichformProps, RichformEventProps, RichformSlots>

export type SizeType = 'default' | 'large' | 'mini'

declare function AJValidate(schema: object, values: object, errors: object): boolean

export type FormType = {
    border?: boolean
    grid?: boolean
    labelSuffix?: string
    labelWidth?: string
    labelAlign?: string
    labelInline?: boolean
    size?: SizeType
    colors?: object
    actions?: Array<any>
    layout?: Array<any>
}

export interface RichformConstructor { // extends RichformMethods 
    id: string
    props: RichformProps,
    friendSchema?: SchemaType,
    friendForm?: FormType,
    topActions?: any,
    buttomActions?: any,
    noReady?: boolean,
}

export interface RichformProps {
    values?: RichformProps.values,
    form?: RichformProps.form,
    schema?: RichformProps.schema,
    isDesign?: RichformProps.isDesign,
    showBtns?: RichformProps.showBtns,
    deepValues?: RichformProps.deepValues,
    isFriendValue?: RichformProps.isFriendValue,
    authorization?: RichformProps.authorization,
    item?: RichformPropsTypes.item,
    fieldErrors?: RichformPropsTypes.fieldErrors,
}

export namespace RichformPropsTypes {
    export type values = object
    export type form = FormType
    export type schema = SchemaType
    export type isDesign = boolean
    export type showBtns = boolean
    export type deepValues = boolean
    export type isFriendValue = boolean
    export type authorization = object
    export type item = object
    export type fieldErrors = object
}

export interface RichformEventProps {

}

export interface RichformSlots {

}

export interface RichformMethods {
    globalValidate(schema: object, values: object, fieldErrors?: object): boolean,
    resetValues(): void
}

export type SchemaType = {
    $schema?: string
    title?: string
    description?: string
    type?: string
    properties?: object
    errorMessage?: object
    if?: object
    then?: object
    else?: object
    required?: Array<any>
}

export type ButtonType = {
    name: string
    type: 'primary' | 'success' | 'warning' | 'danger' | 'info' | 'text'
    title: string
    icon: string
    tips: string
    right: boolean
    visible: boolean
    top: boolean
    size: SizeType
    nativeType?: 'button' | 'submit' | 'reset'
}

export interface RichformReactData {
    hideFields: object
    dependencies: object
    flatFields: object
    requireds: Array<any>
    context: ContextType
    regExpFields: object,
    clickedField: any,
    fieldErrors: any,
}

export type ContextType = {
    loadDebounce: any,
    loadCompleted: boolean,
    deepValueKeys: Array<any>,
}

export type GroupType = {
    name: string
    title: string
    widget: string
}

export type CollapseType = {
    name: string
    title: string
    widget: string
    expand: boolean
    actions: Array<any>
    fields: Array<any>
    isClicked?: boolean
    style?: object
    activeDesign?: boolean
}

export type TabsType = {

}



