

const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.js');
const require_CredoError = require('../../../error/CredoError.js');
require('../../../error/index.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');
const require_GenericRecord = require('../repository/GenericRecord.js');
const require_GenericRecordsRepository = require('../repository/GenericRecordsRepository.js');
let tsyringe = require("tsyringe");
tsyringe = require_rolldown_runtime.__toESM(tsyringe);

//#region src/modules/generic-records/services/GenericRecordService.ts
var _ref;
let GenericRecordService = class GenericRecordService$1 {
	constructor(genericRecordsRepository) {
		this.genericRecordsRepository = genericRecordsRepository;
	}
	async save(agentContext, { content, tags, id }) {
		const genericRecord = new require_GenericRecord.GenericRecord({
			id,
			content,
			tags
		});
		try {
			await this.genericRecordsRepository.save(agentContext, genericRecord);
			return genericRecord;
		} catch (error) {
			throw new require_CredoError.CredoError(`Unable to store the genericRecord record with id ${genericRecord.id}. Message: ${error}`);
		}
	}
	async delete(agentContext, record) {
		try {
			await this.genericRecordsRepository.delete(agentContext, record);
		} catch (error) {
			throw new require_CredoError.CredoError(`Unable to delete the genericRecord record with id ${record.id}. Message: ${error}`);
		}
	}
	async deleteById(agentContext, id) {
		await this.genericRecordsRepository.deleteById(agentContext, id);
	}
	async update(agentContext, record) {
		try {
			await this.genericRecordsRepository.update(agentContext, record);
		} catch (error) {
			throw new require_CredoError.CredoError(`Unable to update the genericRecord record with id ${record.id}. Message: ${error}`, { cause: error });
		}
	}
	async findAllByQuery(agentContext, query, queryOptions) {
		return this.genericRecordsRepository.findByQuery(agentContext, query, queryOptions);
	}
	async findById(agentContext, id) {
		return this.genericRecordsRepository.findById(agentContext, id);
	}
	async getAll(agentContext) {
		return this.genericRecordsRepository.getAll(agentContext);
	}
};
GenericRecordService = require_decorate.__decorate([(0, tsyringe.injectable)(), require_decorateMetadata.__decorateMetadata("design:paramtypes", [typeof (_ref = typeof require_GenericRecordsRepository.GenericRecordsRepository !== "undefined" && require_GenericRecordsRepository.GenericRecordsRepository) === "function" ? _ref : Object])], GenericRecordService);

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