/** Signed webhook receiver lifecycle under the daemon service supervisor. */
import { startHostedWebhookReceivers } from '../daemon-webhooks.js';
import { BaseDaemonService } from './service.js';
export class WebhookReceiverService extends BaseDaemonService {
    id = 'webhook-receiver';
    receivers = null;
    async onStart(ctx) {
        this.receivers = await startHostedWebhookReceivers({ log: ctx.log });
        ctx.log('INFO', this.receivers.count > 0
            ? `Webhook receiver hosting ${this.receivers.count} receiver(s)`
            : 'Webhook receiver service enabled; no receivers declared in daemon/webhooks.yaml');
    }
    async onStop() {
        await this.receivers?.close();
        this.receivers = null;
    }
}
