import { Repository } from 'typeorm';
import { NewCertificate } from '../certificates/entities/new-certificate.entity';
import { Certificate } from '../excel/certificate.entity';
export declare const SOURCE_MANUAL = "Manual";
export declare const SOURCE_NEW = "QRS & TQS";
export type ReportSource = typeof SOURCE_MANUAL | typeof SOURCE_NEW;
export interface AgingRow {
    source: ReportSource;
    certificate_no: string;
    company_name: string;
    standard: string;
    cert_type: string | null;
    category: string;
    status: string | null;
    originally_registered: string | null;
    issue_date: string | null;
    expire_date: string | null;
    issue_year: number | null;
    age_days: number | null;
    age_years: number | null;
    days_to_expiry: number | null;
    aging_bucket: string;
    expiry_status: 'expired' | 'expiring_soon' | 'valid' | 'unknown';
}
export interface AgingSummary {
    total: number;
    bySource: Record<string, number>;
    byBucket: Record<string, number>;
    byCategory: Record<string, number>;
    byStandard: Record<string, number>;
    byIssueYear: Record<string, number>;
    expired: number;
    expiringWithin90: number;
    undatedSkipped: number;
}
export interface AgingReport {
    meta: {
        from_year: number;
        to_year: number;
        from_date?: string;
        to_date?: string;
        period_label: string;
        category?: string;
        source_filter: ReportSource | 'All';
        as_of: string;
        generated_at: string;
        buckets: string[];
    };
    summary: AgingSummary;
    rows: AgingRow[];
}
export interface AgingReportOptions {
    fromYear?: number;
    toYear?: number;
    fromDate?: Date;
    toDate?: Date;
    basis?: 'issue' | 'expire';
    mode?: 'range' | 'cycle';
    year?: number;
    months?: number[];
    asOf?: Date;
    standard?: string;
    category?: string;
    source?: ReportSource;
    includeUndated?: boolean;
    dedupeByCertNo?: boolean;
}
export declare class AgingAnalysisService {
    private readonly certRepo;
    private readonly legacyRepo;
    private readonly DAY;
    private readonly BUCKETS;
    private readonly CYCLE_MAP;
    constructor(certRepo: Repository<NewCertificate>, legacyRepo: Repository<Certificate>);
    generate(options?: AgingReportOptions): Promise<AgingReport>;
    private generateCycle;
    private parseCycleCategory;
    private cycleCategoryLabel;
    private monthsLabel;
    private resolveNewSource;
    private normalizeCategory;
    private normalizeStandard;
    private buildPeriodLabel;
    private buildRow;
    private bucket;
    private expiryStatus;
    private expandLegacy;
    private parseLegacyCertNo;
    private expandLegacyStandard;
    private dedupe;
    private summarize;
    private toDate;
    private iso;
}
