import { BaseRepository } from './base-repository.js';
import 'drizzle-orm/pg-core';
import 'drizzle-orm';
import '../types/drizzle.js';
import 'drizzle-orm/node-postgres';

/**
 * Per-entity Activity config (matches `ActivityPatternConfigSchema` in
 * `src/patterns/library/activity.pattern.ts`). Carried on the concrete repo as
 * `patternConfig` and read here to resolve column names at runtime.
 */
interface ActivityPatternConfig {
    /** Subject entity name → derives the FK column `<subject>_id`. */
    subject?: string;
    /** Explicit snake_case FK column, when it does not follow `<subject>_id`. */
    subjectColumn?: string;
    /** snake_case recency-ordering column; defaults to `occurred_at`. */
    occurredAt?: string;
}
declare abstract class ActivityEntityRepository<TEntity> extends BaseRepository<TEntity> {
    /**
     * Per-entity Activity config. The template emits this from `config:
     * { Activity: {...} }`; entities that only use date-range / user scoping omit
     * it (and must not call the subject finders).
     */
    protected readonly patternConfig?: ActivityPatternConfig;
    /**
     * camelCase key for the recency-ordering column. Defaults to `occurredAt`
     * (column `occurred_at`); override via `patternConfig.occurredAt`.
     */
    protected get occurredAtColumn(): string;
    /**
     * camelCase key for the subject FK column, resolved from `patternConfig`:
     * `subjectColumn` (explicit) → `<subject>_id` (derived). Throws when neither
     * is configured — the subject finders are unusable without it, and a clear
     * error beats a silent `undefined` column index.
     */
    protected get subjectColumn(): string;
    /**
     * Find activities within a date range (inclusive), by the recency column.
     */
    findByDateRange(start: Date, end: Date): Promise<TEntity[]>;
    /**
     * Find all activities for a specific user (actor / owner scoping).
     */
    findByUserId(userId: string): Promise<TEntity[]>;
    /**
     * Find all activities for a specific subject (config-driven FK column).
     */
    findBySubjectId(subjectId: string): Promise<TEntity[]>;
    /**
     * Find the most recent activities for a subject, ordered by the recency
     * column descending.
     */
    findRecentBySubjectId(subjectId: string, limit?: number): Promise<TEntity[]>;
}

export { ActivityEntityRepository, type ActivityPatternConfig };
