import { DataSource, EntityManager } from 'typeorm';
import { SessionBlock, SlotConfig } from './audit-slot.rules';
export declare const SUBMISSION_WINDOW_DAYS = 4;
export declare const CLOSED_DATES: string[];
export declare const SLOT_TIMEZONE: string;
export declare const SLOT_CONFIG: SlotConfig;
export interface ClosedDate {
    date: string;
    reason?: string;
}
export interface SlotSettings {
    slots_per_time: number;
    max_per_day: number;
    gap_minutes: number;
    day_start: string;
    last_start: string;
    lunch_from: string;
    lunch_to: string;
    window_days: number;
    closed_weekdays: number[];
    closed_dates: ClosedDate[];
}
export declare function defaultSlotSettings(): SlotSettings;
export interface DateSummary {
    date: string;
    booked: number;
    available: number;
    free_slots: number;
    status: 'open' | 'full' | 'closed';
    closed_reason?: string;
}
export interface DaySlotsResponse {
    date: string;
    status: 'open' | 'full' | 'closed' | 'outside_window';
    closed_reason?: string;
    gap_minutes: number;
    slots_per_time: number;
    max_per_day: number;
    booked: number;
    lunch: {
        from: string;
        to: string;
    };
    sessions: SessionBlock[];
    bookings?: {
        time: string | null;
        label: string | null;
        company: string;
        source: string;
    }[];
    server_time: string;
}
export interface SlotCheckOptions {
    excludeRequestId?: number;
    holds?: string[];
}
export declare class AuditSlotsService {
    private readonly dataSource;
    private readonly logger;
    constructor(dataSource: DataSource);
    private runtimeCache;
    private tableMissingLogged;
    private toRuntime;
    private readSettings;
    private runtime;
    private closedInfo;
    canEditSettings(userId: number): Promise<boolean>;
    getSettings(userId: number): Promise<{
        defaults: SlotSettings;
        can_edit: boolean;
        timezone: string;
        today: string;
        settings: SlotSettings;
        saved: boolean;
        updated_at: string | null;
        updated_by: string | null;
    }>;
    saveSettings(body: Partial<SlotSettings>, userId: number): Promise<{
        defaults: SlotSettings;
        can_edit: boolean;
        timezone: string;
        today: string;
        settings: SlotSettings;
        saved: boolean;
        updated_at: string | null;
        updated_by: string | null;
    }>;
    private validateSettings;
    now(): {
        date: string;
        min: number;
    };
    addDays(date: string, n: number): string;
    private windowDatesRt;
    private windowEndRt;
    private inWindowRt;
    private windowDates;
    private inWindow;
    private loadOccupancy;
    private holdsToOccupants;
    getDateSummaries(): Promise<{
        window_start: string;
        window_end: string;
        max_per_day: number;
        slots_per_time: number;
        gap_minutes: number;
        dates: DateSummary[];
    }>;
    getDaySlots(date: string, opts?: SlotCheckOptions & {
        includeBookings?: boolean;
    }): Promise<DaySlotsResponse>;
    assertSlotAvailable(date: string, time: string, manager?: EntityManager, opts?: SlotCheckOptions): Promise<string>;
    assertBatchAvailable(items: {
        company_name: string;
        proposed_date: string;
        proposed_time: string;
    }[]): Promise<void>;
    withDateLock<T>(date: string, fn: (manager: EntityManager) => Promise<T>): Promise<T>;
    private assertDateFormat;
}
