const ALREADY_RUNNING_DISMISS_MESSAGE = "Cette review est déjà en cours, impossible de l'ignorer";
export class DismissPendingReviewUseCase {
    deps;
    constructor(deps) {
        this.deps = deps;
    }
    async execute(input) {
        const { pendingReviewRequestGateway, queuePort, logger } = this.deps;
        const pending = await pendingReviewRequestGateway.load(input.pendingId);
        if (!pending) {
            return { status: 'not-found' };
        }
        if (queuePort.hasActiveJob(pending.job.id)) {
            logger.info({ pendingId: input.pendingId, jobId: pending.job.id }, 'Pending review dismiss rejected: already running');
            return { status: 'already-running', message: ALREADY_RUNNING_DISMISS_MESSAGE };
        }
        await pendingReviewRequestGateway.delete(input.pendingId);
        logger.info({ pendingId: input.pendingId }, 'Pending review dismissed');
        return { status: 'dismissed' };
    }
}
//# sourceMappingURL=dismissPendingReview.usecase.js.map