import { Repository } from '../Repository';
import { Select } from '@fewer/sq';
import { INTERNAL_TYPES, Associations, CommonQuery, WhereType, CreateSelectionSet, ResolveAssociations, Subset } from '../types';
export declare enum AssociationType {
    HAS_ONE = "hasOne",
    HAS_MANY = "hasMany",
    BELONGS_TO = "belongsTo"
}
declare const BASE_TYPE: unique symbol;
declare const FK_TYPE: unique symbol;
declare const IS_CHAINED: unique symbol;
declare type CheckUsedKeys<T, K> = T extends K ? 'This key is already in use.' : T;
export declare class Association<Type extends AssociationType = any, Base extends Repository = any, FK = any, RepoType = any, SelectionSet = any, LoadAssociations extends Associations = {}, JoinAssociations extends Associations = {}, Chained = any, SchemaType = {}> implements CommonQuery<RepoType, LoadAssociations & JoinAssociations> {
    readonly [BASE_TYPE]: Base;
    readonly [FK_TYPE]: FK;
    readonly [IS_CHAINED]: Chained;
    readonly [INTERNAL_TYPES.INTERNAL_TYPE]: RepoType;
    readonly [INTERNAL_TYPES.RESOLVED_TYPE]: Subset<RepoType & ResolveAssociations<LoadAssociations>, SelectionSet, keyof LoadAssociations>;
    readonly [INTERNAL_TYPES.JOINS]: JoinAssociations;
    /**
     * The type of relationship that the association represents, such as "hasMany", and "belongsTo".
     */
    readonly type: Type;
    readonly [INTERNAL_TYPES.SCHEMA_TYPE]: SchemaType;
    private associate;
    private runningQuery?;
    foreignKey: string;
    constructor(type: Type, associate: Repository, runningQuery: Select | undefined, foreignKey: string);
    [INTERNAL_TYPES.TO_SQ_SELECT](): Select;
    getTableName(): string;
    pluck<Key extends keyof RepoType>(...columns: Key[]): Association<Type, Base, FK, RepoType, CreateSelectionSet<SelectionSet, Key>, LoadAssociations, JoinAssociations, true, SchemaType>;
    pluckAs<Key extends keyof RepoType, Alias extends string>(name: Key, alias: Alias): Association<Type, Base, FK, RepoType & {
        [P in Alias]: RepoType[Key];
    }, CreateSelectionSet<SelectionSet, Alias>, LoadAssociations, JoinAssociations, true, SchemaType>;
    limit(amount: number): Association<Type, Base, FK, RepoType, SelectionSet, LoadAssociations, JoinAssociations, true, SchemaType>;
    offset(amount: number): Association<Type, Base, FK, RepoType, SelectionSet, LoadAssociations, JoinAssociations, true, SchemaType>;
    order(): void;
    where(wheres: WhereType<RepoType>): Association<Type, Base, FK, RepoType, SelectionSet, LoadAssociations, JoinAssociations, true, SchemaType>;
    load<Name extends string, LoadAssociation extends Association<AssociationType, Repository<SchemaType>, KeyConstraint>, KeyConstraint = LoadAssociation extends Association<AssociationType.BELONGS_TO> ? keyof SchemaType : any>(name: Name & CheckUsedKeys<Name, keyof LoadAssociations>, association: LoadAssociation): Association<Type, Base, FK, RepoType, SelectionSet, LoadAssociations & {
        [P in Name]: LoadAssociations;
    }, JoinAssociations, true, SchemaType>;
    join<Name extends string, JoinAssociation extends Association<AssociationType, Repository<SchemaType>, KeyConstraint, any, any, any, any, false>, KeyConstraint = JoinAssociation extends Association<AssociationType.BELONGS_TO> ? keyof SchemaType : any>(name: Name & CheckUsedKeys<Name, keyof JoinAssociations>, association: JoinAssociation): Association<Type, Base, FK, RepoType, SelectionSet, LoadAssociations, JoinAssociations & {
        [P in Name]: JoinAssociation;
    }, Chained, SchemaType>;
    private selectQuery;
}
export declare function createBelongsTo<Associate extends Repository, FK extends string>(associate: Associate, foreignKey: FK): Association<AssociationType.BELONGS_TO, any, FK, Associate[INTERNAL_TYPES.INTERNAL_TYPE], INTERNAL_TYPES.ALL_FIELDS, {}, {}, false, Associate[INTERNAL_TYPES.SCHEMA_TYPE]>;
export declare function createHasOne<BaseType extends Repository, Associate extends Repository, FK extends Exclude<keyof Associate[INTERNAL_TYPES.INTERNAL_TYPE], symbol | number>>(base: BaseType, associate: Associate, foreignKey: FK): Association<AssociationType.HAS_ONE, BaseType, FK, Associate[INTERNAL_TYPES.INTERNAL_TYPE], INTERNAL_TYPES.ALL_FIELDS, {}, {}, false, Associate[INTERNAL_TYPES.SCHEMA_TYPE]>;
export declare function createHasMany<BaseType extends Repository, Associate extends Repository, FK extends Exclude<keyof Associate[INTERNAL_TYPES.INTERNAL_TYPE], symbol | number>>(base: BaseType, associate: Associate, foreignKey: FK): Association<AssociationType.HAS_MANY, BaseType, FK, Associate[INTERNAL_TYPES.INTERNAL_TYPE], INTERNAL_TYPES.ALL_FIELDS, {}, {}, false, Associate[INTERNAL_TYPES.SCHEMA_TYPE]>;
export {};
