import { PoolClient, Pool } from 'pg';
import { Repositories } from './Repositories';
export interface Reader<T> {
    find(item: Partial<T>): Promise<T[]>;
    findOne(id: string | Partial<T>): Promise<T | undefined>;
}
export interface Writer<T> {
    create(value: Partial<T>): Promise<T>;
    update(where: Partial<T>, newValue: Partial<T>): Promise<T[]>;
    delete(where: Partial<T>): Promise<number>;
}
export type Repository<T> = Reader<T> & Writer<T>;
export type PageResult<T> = {
    items: T[];
    totalCount: number;
    pageSize: number;
};
export type SortDirection = 'desc' | 'asc';
export declare const DEFAULT_PAGE_SIZE = 20;
export declare abstract class AbstractRepository<SHAPE extends object, DATA_CLASS extends SHAPE> implements Reader<SHAPE>, Writer<SHAPE> {
    protected repositories: Repositories;
    protected pool: Pool;
    protected classRef: {
        new (data?: Record<string, unknown>): DATA_CLASS;
    };
    protected tableName: string;
    /** object where the key is the model property name amd the value is sql column name */
    protected modelPropertyToSqlColumn: {
        [key in keyof SHAPE]: string;
    };
    /** object where the key is the sql column name and the value is the model property name */
    protected sqlColumnToModelProperty: {
        [key: string]: string;
    };
    constructor(repositories: Repositories, pool: Pool, tableName: string, mapping: {
        [key in keyof SHAPE]: string;
    }, classRef: {
        new (data?: Record<string, unknown>): DATA_CLASS;
    });
    protected getConnection(): Promise<PoolClient>;
    create(value: DATA_CLASS, transactionClient?: PoolClient | null): Promise<SHAPE>;
    update(where: Partial<SHAPE>, newValue: Exclude<Partial<SHAPE>, Record<string, never>>, transactionClient?: PoolClient | null): Promise<SHAPE[]>;
    delete(where: Partial<SHAPE>, transactionClient?: PoolClient | null): Promise<number>;
    protected createWhereStringFromPartialModel(values: Partial<SHAPE>, initialIndex?: number): string;
    protected executeQueryRaw(query: string, values: any[], transactionClient?: PoolClient | null): Promise<any[]>;
    executeQuery(query: string, values: any[], transactionClient?: PoolClient | null): Promise<SHAPE[]>;
    protected createAndHydrateModel(row: any): SHAPE;
    findOne(item: Partial<SHAPE>, transactionClient?: PoolClient): Promise<SHAPE | undefined>;
    find(item: Partial<SHAPE>): Promise<SHAPE[]>;
    findAll(): Promise<SHAPE[]>;
    getCount(item?: Partial<SHAPE> | null): Promise<number>;
    getPage(pageNumber: number, sortBy?: (keyof SHAPE)[], direction?: SortDirection, pageSize?: number | null, item?: Partial<SHAPE> | null): Promise<PageResult<SHAPE>>;
    getCountRaw(whereClause?: string, values?: any[], tableRef?: string): Promise<number>;
    getPageRaw(pageNumber: number, sortBy?: (keyof SHAPE)[], direction?: SortDirection, whereClause?: string, tableRef?: string, values?: any[], pageSize?: number | null, searchFields?: Partial<SHAPE> | null): Promise<PageResult<SHAPE>>;
}
