namespace Monitoring.Core.Domain.EventManagement;

/// <summary>
/// Код события.
/// </summary>
public class EventCode
{
	/// <summary>
	/// Идентификатор кода события.
	/// </summary>
	public EventCodeId Id { get; } = default!;

	/// <summary>
	/// Значение кода события.
	/// </summary>
	public EventCodeValue Value { get; } = default!;

	/// <summary>
	/// Группа кода события.
	/// </summary>
	public EventCodeGroup Group { get; }

	/// <summary>
	/// Указывает на активацию события.
	/// </summary>
	public bool IsActive { get; }

	/// <summary>
	/// Создает код события.
	/// </summary>
	/// <param name="value">Значение.</param>
	/// <param name="group">Группа.</param>
	/// <returns>Код события.</returns>
	public static EventCode Create(EventCodeValue value, EventCodeGroup group, bool isActive)
	{
		return new EventCode(new EventCodeId(Guid.NewGuid()), value, group, isActive);
	}

	public static EventCode Create(EventCodeId id, EventCodeValue value, EventCodeGroup group, bool isActive)
	{
		return new EventCode(id, value, group, isActive);
	}

	private EventCode(EventCodeId id, EventCodeValue value, EventCodeGroup group, bool isActive)
	{
		Id = id;
		Value = value;
		Group = group;
		IsActive = isActive;
	}

	protected EventCode() { }
}
