import { OnDestroy, OnInit } from '@angular/core';
import { BaseAngularComponent } from '@memberjunction/ng-base-types';
import { PredictiveStudioEngine } from '../engine/predictive-studio.engine';
import { PSProcessRunRow } from '../predictive-studio.view-models';
import { StatusVariant } from '../production-distribution';
import * as i0 from "@angular/core";
/** A model's deployment state, derived purely from cached bindings + Record Processes. */
type DeployState = 'bound' | 'scheduled' | 'idle';
/** One scoring binding shown in a model's deployment detail. */
interface BindingVM {
    id: string;
    targetEntity: string;
    targetColumn: string;
    mode: string;
    schedulePhrase: string | null;
}
/** One published model in the production control tower (DB-light — all fields from engine caches). */
interface ProductionModelVM {
    modelId: string;
    label: string;
    algorithm: string;
    problemType: string;
    version: number;
    holdoutMetric: string;
    deployState: DeployState;
    bindingCount: number;
    processCount: number;
    scheduledCount: number;
    /** Most recent scored-at across the model's bindings (cached lineage — no DB hit). */
    lastScoredAt: Date | null;
    lastRowCount: number | null;
}
/** One per-record prediction in a run's drill-in (parsed from `MJ: Process Run Details` `ResultPayload`). */
interface RunDetailVM {
    recordId: string;
    status: string;
    /** Formatted numeric prediction, or '—'. */
    score: string;
    /** Predicted class label (classification), or null. */
    class: string | null;
    /** ISO timestamp the prediction was produced (`$.scoredAt`), or the detail's completion time. */
    scoredAt: string | null;
}
/**
 * Models in Production — the **model-centric** control tower. Every approved (Published) model appears
 * here whether it's idle, scheduled, or bound — a scoring binding is a *deployment marker*, not a
 * prerequisite to appear or to run. Reactive + DB-light: the published-model list and each model's
 * deployment state come straight from the `PredictiveStudioEngine` caches (a `BaseEngine` subclass) via
 * `ObserveProperty`, so it re-renders on any model/binding change with no polling; a model's **past runs**
 * are loaded on demand when selected (`MJ: Process Runs` grow unbounded — never bulk-cached).
 *
 * Entity-agnostic: model labels derive from the producing pipeline; binding targets come from the binding
 * rows. **Operate** (the rocket button) opens the {@link PSOperateDialogComponent} to run/schedule/bind the
 * model; clicking a run drills into its per-record predictions (`MJ: Process Run Details`).
 */
export declare class PSProductionComponent extends BaseAngularComponent implements OnInit, OnDestroy {
    engine: PredictiveStudioEngine;
    private cdr;
    private modelsSub?;
    models: ProductionModelVM[];
    selectedModelId: string;
    selectedBindings: BindingVM[];
    runs: PSProcessRunRow[];
    loadingRuns: boolean;
    /** Whether the "Operate this model" dialog is open for the selected model. */
    operateOpen: boolean;
    /** The run whose per-record predictions are drilled into (null = the run list). */
    selectedRunId: string | null;
    runDetails: RunDetailVM[];
    loadingDetails: boolean;
    ngOnInit(): void;
    ngOnDestroy(): void;
    get scheduledModelCount(): number;
    get boundModelCount(): number;
    get idleModelCount(): number;
    private rebuildModels;
    private toVM;
    private bindingsForModel;
    private toBindingVM;
    private resolveEntityName;
    get selected(): ProductionModelVM;
    /**
     * Close the Operate dialog. On a successful change the dialog already refreshed the engine
     * (Config(true)) — the reactive `_Models` subscription re-renders the deploy state — but the
     * on-demand run history + bindings of the SELECTED model are not part of that stream, so reload them
     * here so a just-created run / binding shows immediately.
     */
    onOperateClose(result: {
        changed: boolean;
    }): void;
    select(id: string): void;
    /** Drill into a run's per-record predictions (`MJ: Process Run Details` `ResultPayload`). */
    openRun(runId: string): void;
    closeRun(): void;
    private loadRunDetails;
    /** Project a Process Run Detail into a per-record prediction row, parsing the ML `ResultPayload`. */
    private toDetailVM;
    /** On-demand run history for the selected model (DB-light — only the selected model, capped). */
    private loadRuns;
    deployIcon(state: DeployState): string;
    deployLabel(state: DeployState): string;
    deployBadge(state: DeployState): StatusVariant;
    modeBadge(mode: string): StatusVariant;
    runBadge(status: string): StatusVariant;
    static ɵfac: i0.ɵɵFactoryDeclaration<PSProductionComponent, never>;
    static ɵcmp: i0.ɵɵComponentDeclaration<PSProductionComponent, "ps-production", never, { "engine": { "alias": "engine"; "required": false; }; }, {}, never, never, true, never>;
}
export {};
//# sourceMappingURL=ps-production.component.d.ts.map