import type { WaferMetadata } from '../core/metadata.js';
/** Bucket label for wafers with no value for the active facet field — kept
 *  visible (not dropped) so grouped output stays honest about what it's missing. */
export declare const FACET_NONE_VALUE = "(none)";
/**
 * camelCase/snake_case key → "Title Case" label — the one label convention
 * every metadata surface in this library uses for an uncurated field
 * (`DEFAULT_FACET_CURATION`'s own `label`s, e.g. "Program", intentionally
 * differ and are reserved for facet/group-by UI, not general display — see
 * `buildFacetTable`'s callers in canvas-adapter). Shared by the canvas
 * (Summary panel, metadata badge) and stats (HTML report) layers so a field
 * is never labelled two different ways depending which surface rendered it.
 */
export { prettyKey } from '../core/utils.js';
/** One distinct value of a facet field, with how much data it covers. */
export interface FacetValue {
    value: string;
    waferCount: number;
    dieCount: number;
}
/** A metadata field that wafers can be grouped/split on, plus its distinct values. */
export interface FacetField {
    /** WaferMetadata key (e.g. `lot`, `temperature`, or a caller-supplied extra key). */
    key: string;
    /** Human-readable label — curated, or the raw key for uncurated fields. */
    label: string;
    /** Distinct non-empty values, sorted by coverage (wafer count desc, then label). */
    values: FacetValue[];
    /** True when the field has more than one distinct value — i.e. splitting on it actually partitions the data. */
    splittable: boolean;
}
/** Curation for one metadata key: label + whether it's offered as a facet by default + date handling. */
export interface FacetCuration {
    label: string;
    /** Show this field in the facet table by default. Defaults to true when omitted. */
    facet?: boolean;
    /** Value is an ISO datetime; facet by its date portion only, not full timestamp. */
    date?: boolean;
}
/** Default curation for wmap's own known `WaferMetadata` keys. Callers extend
 *  (not replace) this via `buildFacetTable`'s `curation` option — their own
 *  app-specific extra keys layer on top rather than needing to redeclare these. */
export declare const DEFAULT_FACET_CURATION: Record<string, FacetCuration>;
/** The faceting value of one metadata key for one wafer's metadata — the raw
 *  value, except date-curated fields are truncated to date-only so grouping
 *  is by day, not timestamp. */
export declare function facetValueOf(metadata: WaferMetadata | undefined, key: string, curation?: Record<string, FacetCuration>): string | undefined;
export interface FacetItem {
    metadata?: WaferMetadata;
    /** Die count for this wafer, if known — used for `FacetValue.dieCount` coverage. Omit if not tracked; defaults to 0. */
    dieCount?: number;
}
/** Fields present with the same value on every item's `metadata` — the
 *  conservative lot identity a mixed population can safely display. A field
 *  that varies per item (e.g. `waferId`) is naturally excluded, since it
 *  won't be common across all items. Returns `{}` for an empty list (no
 *  false lot-level claim about zero wafers). */
export declare function commonMetadata(items: Array<{
    metadata?: WaferMetadata;
}>): WaferMetadata;
export interface BuildFacetTableOptions {
    /** Extra/override curation entries layered on top of `DEFAULT_FACET_CURATION` — a caller's own app-specific keys (or a relabel of a default one) without losing wmap's built-in defaults. */
    curation?: Record<string, FacetCuration>;
    /** Restrict to fields curated `facet: true` (the default) plus any uncurated key. Pass `false` to include curated-but-`facet:false` fields too. */
    facetableOnly?: boolean;
}
/**
 * Build the distinct-values table over a set of wafers' metadata. One entry
 * per key present on at least one item's `metadata`; curated keys appear
 * first in `DEFAULT_FACET_CURATION`/`curation` order, uncurated keys after
 * (labelled by their raw key). Counts are exact over the full input.
 */
export declare function buildFacetTable(items: FacetItem[], options?: BuildFacetTableOptions): FacetField[];
//# sourceMappingURL=facets.d.ts.map