import { WorkspaceScopedResource, extractData } from './base.js';
/**
 * Pipeline — observability into the workspace's data ingestion pipeline:
 * source health, throughput, entity resolution metrics, review backlog,
 * outbound deliveries, and per-source overviews / event histories.
 *
 * @beta New in this release; surface may evolve.
 */
export class PipelineResource extends WorkspaceScopedResource {
    /** Overall pipeline status (sources up/down, last successful run, etc.) */
    async getStatus() {
        return extractData(await this.client.GET('/v1/{workspace_id}/pipeline/status', {
            params: { path: { workspace_id: this.workspaceId } },
        }));
    }
    /** Throughput buckets over the recent window */
    async getThroughput() {
        return extractData(await this.client.GET('/v1/{workspace_id}/pipeline/throughput', {
            params: { path: { workspace_id: this.workspaceId } },
        }));
    }
    /** Review backlog metrics (pending merges, pending escalations) */
    async getReview() {
        return extractData(await this.client.GET('/v1/{workspace_id}/pipeline/review', {
            params: { path: { workspace_id: this.workspaceId } },
        }));
    }
    /** Entity resolution metrics (merge rate, candidate rate, false-positive rate) */
    async getEntityResolution() {
        return extractData(await this.client.GET('/v1/{workspace_id}/pipeline/entity-resolution', {
            params: { path: { workspace_id: this.workspaceId } },
        }));
    }
    outbound = {
        /** List recent outbound deliveries */
        list: async () => extractData(await this.client.GET('/v1/{workspace_id}/pipeline/outbound', {
            params: { path: { workspace_id: this.workspaceId } },
        })),
        /** Get the delivery log for a specific outbound data source */
        getLog: async (dataSourceId, params) => extractData(await this.client.GET('/v1/{workspace_id}/pipeline/outbound/{data_source_id}/log', {
            params: {
                path: { workspace_id: this.workspaceId, data_source_id: dataSourceId },
                query: params,
            },
        })),
    };
    sources = {
        /** List all configured pipeline sources */
        list: async (params) => extractData(await this.client.GET('/v1/{workspace_id}/pipeline/sources', {
            params: { path: { workspace_id: this.workspaceId }, query: params },
        })),
        /** Get a per-source overview (last sync, error counts, deltas) */
        getOverview: async (sourceId) => extractData(await this.client.GET('/v1/{workspace_id}/pipeline/sources/{source_id}/overview', {
            params: { path: { workspace_id: this.workspaceId, source_id: sourceId } },
        })),
        /** Stream the source's recent events */
        listEvents: async (sourceId, params) => extractData(await this.client.GET('/v1/{workspace_id}/pipeline/sources/{source_id}/events', {
            params: {
                path: { workspace_id: this.workspaceId, source_id: sourceId },
                query: params,
            },
        })),
        /** Per-source historical timeline */
        getHistory: async (sourceId) => extractData(await this.client.GET('/v1/{workspace_id}/pipeline/sources/{source_id}/history', {
            params: { path: { workspace_id: this.workspaceId, source_id: sourceId } },
        })),
    };
}
//# sourceMappingURL=pipeline.js.map