import { getLogger } from "../utils/logger.js";
import { BaseApiClient, BaseApiError } from "./base-client.js";

//#region src/api-client/eval-api-client.ts
const logger = getLogger("eval-api-client");
var EvalApiError = class extends BaseApiError {
	constructor(message, statusCode, responseBody) {
		super(message, statusCode, responseBody);
		this.name = "EvalApiError";
	}
};
var EvalApiClient = class extends BaseApiClient {
	constructor(config) {
		super(config);
	}
	/**
	* Override to return EvalApiError
	*/
	createError(message, statusCode, responseBody) {
		return new EvalApiError(message, statusCode, responseBody);
	}
	/**
	* Trigger an evaluation job
	* Filters conversations based on job filters, creates an evaluation run, and enqueues workflows
	*/
	async triggerEvaluationJob(request) {
		const tenantId = this.checkTenantId();
		const path = `/tenants/${tenantId}/projects/${this.projectId}/evaluate-conversations-by-job`;
		logger.info({
			tenantId,
			projectId: this.projectId,
			evaluationJobConfigId: request.evaluationJobConfigId,
			evaluatorCount: request.evaluatorIds.length
		}, "Triggering evaluation job workflow");
		return this.makePostRequest(path, request, "Failed to trigger evaluation job workflow");
	}
	async triggerConversationEvaluation(request) {
		const tenantId = this.checkTenantId();
		const path = `/tenants/${tenantId}/projects/${this.projectId}/evaluate-conversation`;
		logger.info({
			tenantId,
			projectId: this.projectId,
			conversationId: request.conversationId
		}, "Triggering conversation evaluation workflow");
		return this.makePostRequest(path, request, "Failed to trigger conversation evaluation workflow");
	}
};

//#endregion
export { EvalApiClient, EvalApiError };