import { WebhookType, EventTriggerType } from "./CreateTrigger";
import { ArgsDefinition } from "./action";
type SortConfigType = {
    [column: string]: "ASC" | "DESC" | boolean;
    active: boolean;
};
type IndexType = "btree" | "hash" | "gist" | "gin" | "spgist" | "brin";
type InferredWith = {
    table: string;
    column: string;
};
type RegisteredParam = ArgsDefinition & {
    required?: boolean;
    inferredWith?: InferredWith;
};
type SchemaInsight<T> = {
    name: string;
    columns: SchemaColumns;
    sorts: SortConfigType[];
    baseCondition: any;
    insight: T;
    params: string[];
    registeredParams: Record<string, RegisteredParam>;
};
type SchemaTrigger = {
    name: string;
    webhook: WebhookType;
    destination?: string;
    event: EventTriggerType;
    maxAttempts?: number;
};
export type SchemaTables = {
    name: string;
    primaryKey?: string;
    columns: SchemaColumns;
    roles: SchemaRoles;
    views: SchemaView[];
    insights: SchemaInsight<{}>[];
    triggers: SchemaTrigger[];
    indexes: SchemaIndexes[];
};
export type References = {
    targetTable: string;
    column: string;
    type: string;
    origin: boolean;
    name?: string;
    onUpdate: "CASCADE" | "RESTRICT" | "SET NULL";
    onDelete: "CASCADE" | "RESTRICT" | "SET NULL";
};
type SchemaColumns = {
    name: string;
    type: string;
    description: string | null;
    references?: References;
    definition?: Record<string, any>;
    metadata?: Record<string, any>;
    isHidden: boolean;
}[];
type SchemaRoles = {
    name: string;
    permissions: {
        action: string;
        condition: Record<any, any>;
    }[];
}[];
type SchemaView = {
    name: string;
    query: any;
    sorts: Record<string, "ASC" | "DESC">[];
    baseCondition: any;
    roles: SchemaRoles;
};
type SchemaIndexColumn = {
    name: string;
};
type SchemaIndexes = {
    name: string;
    columns: SchemaIndexColumn[];
    condition: string;
    type: IndexType;
    unique: boolean;
};
export {};
