using Microsoft.EntityFrameworkCore;
using Monitoring.Core.Domain.EventManagement;
using Monitoring.Infrastructure.Data;

namespace Monitoring.Features.AlarmManagement.Skippers;

internal sealed class CallsCompletedStatusSkipper(IDataContext dataContext) : ISkipper
{
	public async Task<bool> Test(AlarmScope scope, AlarmScopeStatus status)
	{
		var hasAnyRealAlarmConfirmation = await dataContext.Calls.AnyAsync(x =>
			x.AlarmScopeId == scope.Id && x.IsConfirmedRealAlarm
		);
		return hasAnyRealAlarmConfirmation;
	}
}
