/// <reference types="lodash" />
import type { Schema } from 'amis-core';
import { IObservableArray } from 'mobx';
import { DatabaseDialectType, DataSourceItem, DBTable, DBTableBrief, FieldItem, FieldType, FormSchema, ModelItem, RelationMode, RelationShipItem, RelationType, TableColumn } from '../type';
import { Manager } from './Manager';
import { ModelStore } from './ModelStore';
import { PluginInterface } from './PluginInterface';
export declare class MainStore {
    readonly manager: Manager;
    constructor(manager: Manager);
    datasource: DataSourceItem;
    get datasourceData(): DataSourceItem;
    setDatasource(value: DataSourceItem): void;
    dbTables: Array<DBTableBrief | DBTable>;
    dbTablesLoaded: boolean;
    dbDialectTypes: Array<DatabaseDialectType & {
        plugin: PluginInterface;
    }>;
    relationTypes: Array<RelationType & {
        plugin: PluginInterface;
    }>;
    fieldTypes: Array<FieldType & {
        plugin: PluginInterface;
    }>;
    get supportRelationship(): boolean;
    get schemaLess(): boolean | undefined;
    get modelMode(): "auto-sync" | "manual-sync" | "no-sync";
    get creatableFieldTypes(): (FieldType & {
        plugin: PluginInterface;
    })[];
    models: IObservableArray<ModelStore>;
    get items(): ModelItem[];
    getModelById(id: string): ModelStore | undefined;
    getModelByKey(key: string): ModelStore | undefined;
    setModels(values: ModelItem[]): void;
    fixReference(): void;
    addModel(value: ModelItem | ModelItem[]): void;
    removeModel(value: ModelItem | ModelItem[]): void;
    updateLines: import("lodash").DebouncedFunc<() => void>;
    addFieldsActive: boolean;
    addFieldsContext: {
        model: ModelItem;
        dbTable?: DBTable;
    } | null;
    activeAddFields(model: ModelItem): Promise<void>;
    deActiveAddFields(): void;
    addRelationActive: boolean;
    addRelationContext: {
        model: ModelItem;
        data?: any;
    } | null;
    addRelationFormSchema?: FormSchema;
    activeAddRelation(model: ModelItem, schema: FormSchema, data?: {}): void;
    deActiveAddRelation(): void;
    addModelFormSchema: FormSchema | null;
    addModelFormSchemaReadyAt: number;
    addModelFormSchemaData?: any;
    setAddModelFormSchema(schema: FormSchema, data?: {}): void;
    editDatasourceFormSchema: FormSchema | null;
    editDatasourceFormSchemaReadyAt: number;
    editDatasourceFormSchemaData?: any;
    setEditDatasourceFormSchema(schema: FormSchema, data?: {}): void;
    editModelActive: boolean;
    editModelFormSchema: Schema;
    editingModelId: string;
    get editingModelData(): ModelItem | null;
    activeEditModel(model: ModelItem, formSchema: Schema, data?: any): void;
    deactiveEditModel(): void;
    editModelFieldActive: boolean;
    editingFieldId: string;
    editingRelationId: string;
    editModelFormFieldSchema: Schema;
    get editingFieldData(): null | RelationShipItem | FieldItem;
    activeEditModelField(model: ModelItem, field: FieldItem, formSchema: Schema, relation?: RelationShipItem): void;
    deactiveEditModelField(): void;
    leftAsideSpinned: boolean;
    leftAsideCollapsed: boolean;
    toggleLeftAsideSpinned(): void;
    toggleLeftAsideCollapsed(): void;
    rightAsideSpinned: boolean;
    rightAsideCollapsed: boolean;
    toggleRightAsideSpinned(): void;
    toggleRightAsideCollapsed(): void;
    diagramViewMode: string;
    toggleDiagramViewMode(): void;
    validate(errors?: Array<string>, models?: ModelItem[]): Promise<boolean>;
    reset(): void;
    /**
     * 弄个 api 拦截器，方便给 amis 提供数据
     */
    makeFetcherInterceptor(): () => void;
    getDBTableDetailOrFake(key: string, allowCreate?: any, toastMsg?: boolean): Promise<DBTable>;
    initEditModel(options: {
        key: string;
        allowCreate: string;
    }): Promise<{
        dbTable?: undefined;
    } | {
        dbTable: DBTable;
    }>;
    initAddModel(options: {
        key: string;
        allowCreate: string;
    }): Promise<{
        key?: undefined;
        name?: undefined;
        dbTable?: undefined;
        fields?: undefined;
        primaryField?: undefined;
        indices?: undefined;
        model?: undefined;
    } | {
        key: string;
        name: string;
        dbTable: DBTable;
        fields: {
            key: string;
            name: string;
            type: string;
            dbType: string;
            isRequired: boolean;
            isUnique: boolean | undefined;
            isPrimaryKey: boolean | undefined;
            isNullable: boolean | undefined;
            isGenerated: boolean | undefined;
            isArray: boolean | undefined;
            comment: string | undefined;
            defaultValue: any;
            length: number | undefined;
        }[];
        primaryField: string;
        indices: {
            columns: string[];
            unique: boolean | undefined;
            name: string;
        }[];
        model: any;
    }>;
    getDBTableList(options: {
        force?: boolean;
    }): Promise<{
        label: string;
        value: string;
        database: string;
    }[]>;
    getJunctionTableList(options: {
        force?: boolean;
    }): Promise<{
        label: string;
        value: string;
        database: string;
    }[]>;
    getDBTableDetail(options: {
        name: string;
        force?: boolean;
    }): Promise<DBTable>;
    getAvailableTables(): Promise<{
        label: string;
        value: string;
        database: string;
    }[]>;
    getAvailableFields(options: {
        model: string;
        fields?: Array<TableColumn>;
        tablename?: string;
        fieldType: string;
        fieldKey: string;
        omitKey?: string;
    }): Promise<{
        label: string;
        value: string;
    }[]>;
    getAvailableForeignKeyFields(options: {
        model: string;
        tablename?: string;
        fieldKey: string;
    }): Promise<any[]>;
    getInverseRelations(options: {
        id?: string;
        model: string;
        mode: RelationMode;
        target: string;
    }): Promise<{
        label: string;
        value: string;
        visibleOn?: string | undefined;
    }[]>;
    getAvailableDatasources(): Promise<{
        options: any[];
    }>;
    getDatasourceDetail(options: {
        dsId: any;
        dsKey?: string;
    }): Promise<any>;
    getAvailableModels(options: {
        dsId?: any;
        dsKey?: string;
        datasource?: any;
    }): Promise<{
        datasource: any;
        models: {
            label: string;
            value: string;
            id: string;
            name: string;
            key: string;
            dsId?: string | undefined;
            fields: FieldItem[];
            relations: RelationShipItem[];
            indices: {
                columns: string[];
                unique?: boolean | undefined;
                name: string;
            }[];
            isRelationShip?: boolean | undefined;
            useSoftDelete?: boolean | undefined;
            isDeleted?: boolean | undefined;
            saveOperator?: boolean | {
                createdBy?: string | boolean | undefined;
                updatedBy?: string | boolean | undefined;
                deletedBy?: string | boolean | undefined;
            } | undefined;
            saveTimestamp?: boolean | {
                createdAt?: string | boolean | undefined;
                updatedAt?: string | boolean | undefined;
                deletedAt?: string | boolean | undefined;
            } | undefined;
            diagramInfo?: {
                x?: number | undefined;
                y?: number | undefined;
            } | undefined;
            description?: string | undefined;
            primaryField?: string | undefined;
            nameField?: string | undefined;
            titleTpl?: string | undefined;
            isTree?: boolean | undefined;
            treePattern?: "adjacency-list" | "nested-set" | "materialized-path" | "closure-table" | undefined;
            customOrder?: boolean | undefined;
            multiTenant?: boolean | undefined;
            validateRules?: any;
            acl?: any;
            aclMode?: "open" | "write-limit" | "delete-limit" | "limit" | "custom" | undefined;
            aclDefault?: any;
            fieldsAcl?: any;
            disabled?: boolean | undefined;
        }[];
    }>;
    modelPluginScaffoldInit(options: {
        dsId?: any;
        key?: any;
        type: string;
        behavior?: string;
    }, payload?: {
        schema: any;
        key?: string;
    }): Promise<any>;
    modelPluginScaffoldSubmit(options: {
        type: string;
    }, payload: {
        key: string;
        schema?: any;
        datasource: DataSourceItem;
        models: Array<ModelItem>;
        [propName: string]: any;
    }): Promise<{
        type: string;
        schema: Schema;
    }>;
    getIndexFields(options: {
        fields: Array<FieldItem>;
    }): Promise<{
        options: FieldItem[];
    }>;
}
