using Monitoring.Core.Domain.UserPrimitives;

namespace Monitoring.Core.Domain.EventManagement;

/// <summary>
/// Сброс тревоги (обязательный комментарий), выполненный пользователем.
/// </summary>
public class AlarmReset
{
	public AlarmResetId Id { get; } = null!;

	public Alarm Alarm { get; } = null!;
	public AlarmId AlarmId { get; } = null!;

	public User ResetBy { get; } = null!;
	public UserId ResetById { get; } = null!;
	public DateTime ResetAt { get; } = DateTime.UtcNow;

	// Текст обязательного комментария
	public string Comment { get; } = string.Empty;

	public static AlarmReset Create(AlarmId alarmId, UserId resetById, string comment)
	{
		return new(new AlarmResetId(Guid.CreateVersion7()), alarmId, resetById, comment);
	}

	private AlarmReset(AlarmResetId id, AlarmId alarmId, UserId resetById, string comment)
	{
		Id = id;
		AlarmId = alarmId;
		ResetById = resetById;
		Comment = comment;
	}

	protected AlarmReset() { }
}
