import { TableInterface, P_CREATE_TABLE_COMMON, P_CREATE_TABLE_LIKE, O_POSITION } from '../../../../typings';
import { TableModelInterface, DatabaseModelInterface, ColumnModelInterface, TableOptionsModelInterface, FulltextIndexModelInterface, SpatialIndexModelInterface, ForeignKeyModelInterface, UniqueKeyModelInterface, IndexModelInterface, PrimaryKeyModelInterface, IndexPropertyKey } from './typings';
/**
 * Class to represent a table as parsed from SQL.
 */
export declare class Table implements TableModelInterface {
    database: DatabaseModelInterface;
    name: string;
    columns?: ColumnModelInterface[];
    options?: TableOptionsModelInterface;
    fulltextIndexes?: FulltextIndexModelInterface[];
    spatialIndexes?: SpatialIndexModelInterface[];
    foreignKeys?: ForeignKeyModelInterface[];
    uniqueKeys?: UniqueKeyModelInterface[];
    indexes?: IndexModelInterface[];
    primaryKey?: PrimaryKeyModelInterface;
    /**
     * Creates a table from a JSON def.
     *
     * @param json JSON format parsed from SQL.
     * @param database Database to assign table to.
     */
    static fromCommonDef(json: P_CREATE_TABLE_COMMON, database: DatabaseModelInterface): Table;
    /**
     * Creates a table from a JSON def.
     *
     * @param json JSON format parsed from SQL.
     * @param tables Already existing tables.
     */
    static fromAlikeDef(json: P_CREATE_TABLE_LIKE, tables?: TableModelInterface[]): Table | undefined;
    /**
     * JSON casting of this object calls this method.
     */
    toJSON(): TableInterface;
    /**
     * Create a deep clone of this model.
     */
    clone(): Table;
    /**
     * Get table with given name.
     *
     * @param name Table name.
     */
    getTable(name: string): TableModelInterface | undefined;
    /**
     * Get tables from database.
     */
    getTables(): TableModelInterface[];
    /**
     * Setter for database.
     *
     * @param database Database instance.
     */
    setDatabase(database: DatabaseModelInterface): void;
    /**
     * Rename table.
     *
     * @param newName New table name.
     */
    renameTo(newName: string): void;
    /**
     * Add a column to columns array, in a given position.
     *
     * @param column Column to be added.
     * @param position Position object.
     */
    addColumn(column: ColumnModelInterface, position?: O_POSITION): void;
    /**
     * Extract column keys like PrimaryKey, ForeignKey,
     * UniqueKey and add them to this table instance.
     *
     * @param column Column to be extracted.
     */
    extractColumnKeys(column: ColumnModelInterface): void;
    /**
     * Move a column to a given position. Returns whether operation was successful.
     *
     * @param column One of this table columns.
     * @param position Position object.
     */
    moveColumn(column: ColumnModelInterface, position: O_POSITION): boolean;
    /**
     * Rename column and references to it. Returns whether operation was successful.
     *
     * @param column Column being renamed.
     * @param newName New name of column.
     */
    renameColumn(column: ColumnModelInterface, newName: string): boolean;
    /**
     * Get column position object.
     *
     * @param column Column.
     */
    getColumnPosition(column: ColumnModelInterface): O_POSITION;
    /**
     * Drops table's primary key.
     */
    dropPrimaryKey(): void;
    /**
     * Drops a column from table.
     *
     * @param column Column to be dropped.
     */
    dropColumn(column: ColumnModelInterface): void;
    /**
     * Drops an index from table.
     *
     * @param index Index to be dropped.
     */
    dropIndexByInstance(index: UniqueKeyModelInterface | IndexModelInterface | FulltextIndexModelInterface | SpatialIndexModelInterface): void;
    /**
     * Drops a foreign key from table.
     *
     * @param foreignKey Foreign key to be dropped.
     */
    dropForeignKey(foreignKey: ForeignKeyModelInterface): void;
    /**
     * Get index by name.
     *
     * @param name Index name.
     */
    getIndexByName(name: string): UniqueKeyModelInterface | IndexModelInterface | FulltextIndexModelInterface | SpatialIndexModelInterface | undefined;
    /**
     * Get which index array is storing a given index.
     *
     * @param indez
     */
    getIndexTypeByInstance(index: UniqueKeyModelInterface | IndexModelInterface | FulltextIndexModelInterface | SpatialIndexModelInterface): IndexPropertyKey | undefined;
    /**
     * Get which index array is storing a given index.
     *
     * @param indez
     */
    getIndexTypeByName(name: string): IndexPropertyKey | undefined;
    /**
     * Get column by name.
     *
     * @param name Column name.
     */
    getColumn(name: string): ColumnModelInterface | undefined;
    /**
     * Get foreign key by name.
     *
     * @param name Foreign key name.
     */
    getForeignKey(name: string): ForeignKeyModelInterface | undefined;
    /**
     * Whether there is a foreign key with given name in table.
     *
     * @param name Foreign key name.
     */
    hasForeignKey(name: string): boolean;
    /**
     * Setter for table's primary key.
     *
     * @param primaryKey Primary key.
     */
    setPrimaryKey(primaryKey: PrimaryKeyModelInterface): void;
    /**
     * Push a fulltext index to fulltextIndexes array.
     *
     * @param fulltextIndex Index to be pushed.
     */
    pushFulltextIndex(fulltextIndex: FulltextIndexModelInterface): void;
    /**
     * Push a spatial index to spatialIndexes array.
     *
     * @param spatialIndex Index to be pushed.
     */
    pushSpatialIndex(spatialIndex: SpatialIndexModelInterface): void;
    /**
     * Push an unique key to uniqueKeys array.
     *
     * @param uniqueKey UniqueKey to be pushed.
     */
    pushUniqueKey(uniqueKey: UniqueKeyModelInterface): void;
    /**
     * Push a foreign key to foreignKeys array.
     *
     * @param foreignKey ForeignKey to be pushed.
     */
    pushForeignKey(foreignKey: ForeignKeyModelInterface): void;
    /**
     * Push an index to indexes array.
     *
     * @param index Index to be pushed.
     */
    pushIndex(index: IndexModelInterface): void;
}
