

const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.js');
const require_constants = require('../../constants.js');
const require_AgentContext = require('../../agent/context/AgentContext.js');
require('../../plugins/index.js');
const require_decorateMetadata = require('../../_virtual/_@oxc-project_runtime@0.94.0/helpers/decorateMetadata.js');
const require_decorate = require('../../_virtual/_@oxc-project_runtime@0.94.0/helpers/decorate.js');
require('../../agent/index.js');
const require_decorateParam = require('../../_virtual/_@oxc-project_runtime@0.94.0/helpers/decorateParam.js');
const require_GenericRecordService = require('./services/GenericRecordService.js');
let tsyringe = require("tsyringe");
tsyringe = require_rolldown_runtime.__toESM(tsyringe);

//#region src/modules/generic-records/GenericRecordsApi.ts
var _ref, _ref2;
let GenericRecordsApi = class GenericRecordsApi$1 {
	constructor(genericRecordsService, logger, agentContext) {
		this.genericRecordsService = genericRecordsService;
		this.logger = logger;
		this.agentContext = agentContext;
	}
	async save({ content, tags, id }) {
		try {
			return await this.genericRecordsService.save(this.agentContext, {
				id,
				content,
				tags
			});
		} catch (error) {
			this.logger.error("Error while saving generic-record", {
				error,
				content,
				errorMessage: error instanceof Error ? error.message : error
			});
			throw error;
		}
	}
	async delete(record) {
		try {
			await this.genericRecordsService.delete(this.agentContext, record);
		} catch (error) {
			this.logger.error("Error while saving generic-record", {
				error,
				content: record.content,
				errorMessage: error instanceof Error ? error.message : error
			});
			throw error;
		}
	}
	async deleteById(id) {
		await this.genericRecordsService.deleteById(this.agentContext, id);
	}
	async update(record) {
		try {
			await this.genericRecordsService.update(this.agentContext, record);
		} catch (error) {
			this.logger.error("Error while update generic-record", {
				error,
				content: record.content,
				errorMessage: error instanceof Error ? error.message : error
			});
			throw error;
		}
	}
	async findById(id) {
		return this.genericRecordsService.findById(this.agentContext, id);
	}
	async findAllByQuery(query, queryOptions) {
		return this.genericRecordsService.findAllByQuery(this.agentContext, query, queryOptions);
	}
	async getAll() {
		return this.genericRecordsService.getAll(this.agentContext);
	}
};
GenericRecordsApi = require_decorate.__decorate([
	(0, tsyringe.injectable)(),
	require_decorateParam.__decorateParam(1, (0, tsyringe.inject)(require_constants.InjectionSymbols.Logger)),
	require_decorateMetadata.__decorateMetadata("design:paramtypes", [
		typeof (_ref = typeof require_GenericRecordService.GenericRecordService !== "undefined" && require_GenericRecordService.GenericRecordService) === "function" ? _ref : Object,
		Object,
		typeof (_ref2 = typeof require_AgentContext.AgentContext !== "undefined" && require_AgentContext.AgentContext) === "function" ? _ref2 : Object
	])
], GenericRecordsApi);

//#endregion
Object.defineProperty(exports, 'GenericRecordsApi', {
  enumerable: true,
  get: function () {
    return GenericRecordsApi;
  }
});