import { WorkspaceScopedResource, extractData } from './base.js';
/**
 * Access call records and intelligence.
 * Calls are read-only in the SDK — they are created by the voice pipeline.
 */
export class CallsResource extends WorkspaceScopedResource {
    /** List calls with optional filtering */
    async list(params) {
        return extractData(await this.client.GET('/v1/{workspace_id}/calls', {
            params: { path: { workspace_id: this.workspaceId }, query: params },
        }));
    }
    listAutoPaging(params) {
        return this.iteratePaginatedList((pageParams) => this.list(pageParams), params);
    }
    /** Get full call detail including turns, escalation, safety, and recording info */
    async get(callId) {
        return extractData(await this.client.GET('/v1/{workspace_id}/calls/{call_id}', {
            params: { path: { workspace_id: this.workspaceId, call_id: callId } },
        }));
    }
    /** Get the canonical playback timeline for a call */
    async getTimeline(callId) {
        return extractData(await this.client.GET('/v1/{workspace_id}/calls/{call_id}/timeline', {
            params: { path: { workspace_id: this.workspaceId, call_id: callId } },
        }));
    }
    /** Get AI intelligence for a call */
    async getIntelligence(callId) {
        return extractData(await this.client.GET('/v1/{workspace_id}/calls/{call_id}/intelligence', {
            params: { path: { workspace_id: this.workspaceId, call_id: callId } },
        }));
    }
    /** Get active intelligence across all in-progress calls */
    async getActiveIntelligence() {
        return extractData(await this.client.GET('/v1/{workspace_id}/calls/active/intelligence', {
            params: { path: { workspace_id: this.workspaceId } },
        }));
    }
    /** Get performance benchmarks for a time period */
    async getBenchmarks(params) {
        return extractData(await this.client.GET('/v1/{workspace_id}/calls/benchmarks', {
            params: { path: { workspace_id: this.workspaceId }, query: params },
        }));
    }
    /** Get phone number call volume breakdown */
    async getPhoneVolume(params) {
        return extractData(await this.client.GET('/v1/{workspace_id}/calls/phone-volume', {
            params: { path: { workspace_id: this.workspaceId }, query: params },
        }));
    }
    /** Get deep call trace analysis */
    async getTraceAnalysis(callId) {
        return extractData(await this.client.GET('/v1/{workspace_id}/calls/{call_id}/trace-analysis', {
            params: { path: { workspace_id: this.workspaceId, call_id: callId } },
        }));
    }
    /** List trace analyses across calls (workspace-scoped feed) */
    async listTraces(params) {
        return extractData(await this.client.GET('/v1/{workspace_id}/calls/traces', {
            params: { path: { workspace_id: this.workspaceId }, query: params },
        }));
    }
    /** Get latest Universal Metric Store values scoped to a single call */
    async getMetrics(callId, params) {
        return extractData(await this.client.GET('/v1/{workspace_id}/calls/{call_id}/metrics', {
            params: {
                path: { workspace_id: this.workspaceId, call_id: callId },
                query: params,
            },
        }));
    }
    /** Place an outbound call from the workspace's voice pipeline */
    async createOutbound(body) {
        return extractData(await this.client.POST('/v1/{workspace_id}/calls/outbound', {
            params: { path: { workspace_id: this.workspaceId } },
            body,
        }));
    }
}
//# sourceMappingURL=calls.js.map