using Monitoring.Core.Domain.EventManagement;
using Monitoring.Core.Domain.UserPrimitives;

namespace Monitoring.Features.AlarmManagement.Skippers;

internal sealed class NewStatusSkipper(UserId currentUserId) : ISkipper
{
	public Task<bool> Test(AlarmScope scope, AlarmScopeStatus status)
	{
		if (scope.StatusHistory.Count == 0)
		{
			throw new InvalidCastException("Alarm scope has no status history");
		}

		return Task.FromResult(scope.StatusHistory.Any(x => x.UserId == currentUserId));
	}
}
