"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.IntegrationDeveloperApiService = void 0;
const common_1 = require("@nestjs/common");
const domain_event_publisher_1 = require("./domain-event.publisher");
const event_subscriber_registry_1 = require("./event-subscriber.registry");
const integration_link_service_1 = require("./integration-link.service");
let IntegrationDeveloperApiService = class IntegrationDeveloperApiService {
    constructor(publisher, subscriberRegistry, linkService) {
        this.publisher = publisher;
        this.subscriberRegistry = subscriberRegistry;
        this.linkService = linkService;
    }
    async publishEvent(input, options) {
        return this.publisher.publishEvent(input, options);
    }
    async publishEvents(events, options) {
        return this.publisher.publishEvents(events, options);
    }
    subscribe(input) {
        this.subscriberRegistry.subscribe(input.eventName, input.consumerName, input.handler, input.priority || 0);
    }
    subscribeMany(definitions) {
        this.subscriberRegistry.subscribeMany(definitions);
    }
    async createLink(dto, persistenceClient) {
        return this.linkService.createLink(dto, persistenceClient);
    }
    async findLinksBySource(query) {
        return this.linkService.findOutbound(query.module, query.entityType, query.entityId);
    }
    async findLinksByTarget(query) {
        return this.linkService.findInbound(query.module, query.entityType, query.entityId);
    }
    async findLinksByType(linkType) {
        return this.linkService.findByLinkType(linkType);
    }
};
exports.IntegrationDeveloperApiService = IntegrationDeveloperApiService;
exports.IntegrationDeveloperApiService = IntegrationDeveloperApiService = __decorate([
    (0, common_1.Injectable)(),
    __metadata("design:paramtypes", [domain_event_publisher_1.DomainEventPublisher,
        event_subscriber_registry_1.EventSubscriberRegistry,
        integration_link_service_1.IntegrationLinkService])
], IntegrationDeveloperApiService);
//# sourceMappingURL=integration-developer-api.service.js.map