/**
 * sinks/bigquery/index.ts
 *
 * BigQuery analytics sink — flattens evaluation reports into rows for
 * the `ailf.reports` and `ailf.area_scores` tables.
 *
 * The BigQuery schema serves as the analytical mirror of the Sanity Content
 * Lake. While Sanity is the system of record for operational queries (Studio
 * dashboards, webhooks, real-time listeners), BigQuery handles the analytical
 * queries that GROQ was never designed for (percentile distributions,
 * cost-per-quality-point trends, cross-source regression detection).
 *
 * Schema evolution: additive-only. New columns with NULLABLE mode don't break
 * existing queries. The `flattenReportRow` and `flattenAreaScoreRows` functions
 * are the single place where schema mapping lives.
 *
 * @see docs/design-docs/report-store/bigquery.md
 * @see docs/design-docs/report-store/sink-architecture.md
 */
import type { Report, SinkHealthStatus, SinkResult } from "../../pipeline/types.js";
import type { ReportSink } from "../types.js";
/** One row per area per model per report in `ailf.area_scores`. */
export interface AreaScoreRow {
    area: string;
    ceiling_score: number;
    code_correctness: number;
    completed_at: string;
    doc_coverage: number;
    doc_lift: number;
    floor_score: number;
    mode: string;
    model_id: string;
    report_id: string;
    source_name: string;
    task_completion: number;
    test_count: number;
    total_cost: number;
    total_score: number;
}
/** Options for constructing a BigQuerySink instance. */
export interface BigQuerySinkOptions {
    /** Path to a service account JSON credentials file */
    credentials?: string;
    /** BigQuery dataset name (e.g., "ailf") */
    dataset: string;
    /** BigQuery project ID (e.g., "ailf-reports") */
    project: string;
}
/** One row per evaluation run in `ailf.reports`. */
export interface ReportRow {
    area_count: number;
    areas: string[];
    avg_doc_lift: number;
    avg_score: number;
    completed_at: string;
    duration_ms: number;
    git_branch: null | string;
    git_pr_number: null | number;
    git_repo: null | string;
    git_sha: null | string;
    grader_cost: null | number;
    grader_model: string;
    mode: string;
    model_count: number;
    models: string[];
    promptfoo_url: null | string;
    promptfoo_urls: null | string;
    report_id: string;
    source_base_url: string;
    source_dataset: null | string;
    source_name: string;
    source_perspective: null | string;
    tag: null | string;
    title: null | string;
    total_cost: null | number;
    trigger_caller_repo: null | string;
    trigger_type: string;
}
/**
 * BigQuery sink — inserts flattened report rows into BigQuery tables.
 *
 * Transforms the nested `Report` into flat rows suitable for SQL analytics.
 * Two tables are populated per publish:
 * - `ailf.reports` — one row per evaluation run
 * - `ailf.area_scores` — one row per area per model per report
 *
 * The sink creates a BigQuery client lazily on first use. If credentials
 * are not provided, it falls back to Application Default Credentials (ADC).
 */
export declare class BigQuerySink implements ReportSink {
    readonly name = "bigquery";
    private client;
    private readonly options;
    constructor(options: BigQuerySinkOptions);
    /**
     * Health check — validates that BigQuery is reachable and the dataset exists.
     *
     * This catches common misconfigurations early (wrong project, missing
     * credentials, non-existent dataset) before the pipeline runs a full eval.
     */
    healthCheck(): Promise<SinkHealthStatus>;
    /**
     * Publish a report to BigQuery — inserts into both tables.
     *
     * The report row goes into `ailf.reports` and the area score rows go
     * into `ailf.area_scores`. Both inserts use streaming inserts for
     * near-real-time availability.
     */
    publish(report: Report): Promise<SinkResult>;
    /** Lazily create the BigQuery client (reused across calls). */
    private getClient;
}
/**
 * Flatten a Report into rows for the `ailf.area_scores` table.
 *
 * Produces one row per area per model. When per-model data is available
 * (multi-model evaluations), each model's area scores become separate rows.
 * When only aggregate scores exist (single model or no per-model breakdown),
 * the model_id is set to the first model in provenance.
 *
 * Denormalized fields (completed_at, mode, source_name) are included for
 * BigQuery partitioning and clustering efficiency.
 */
export declare function flattenAreaScoreRows(report: Report): AreaScoreRow[];
/**
 * Flatten a Report into a single row for the `ailf.reports` table.
 *
 * This is the single place where the nested Report structure maps to
 * the flat BigQuery schema. When the report format evolves, update this
 * function and add new NULLABLE columns to the BigQuery table.
 */
export declare function flattenReportRow(report: Report): ReportRow;
