using Monitoring.Core.Domain.EventManagement;

namespace Monitoring.Core.Domain.CheckListManagement;

/// <summary>
/// Проверка.
/// </summary>
public class CheckList
{
	/// <summary>
	/// ИД проверки.
	/// </summary>
	public CheckListId Id { get; } = null!;

	/// <summary>
	/// Шаблон проверки.
	/// </summary>
	public CheckListTemplateId TemplateId { get; } = null!;

	/// <summary>
	/// Шаблон проверки.
	/// </summary>
	public CheckListTemplate Template { get; } = null!;

	/// <summary>
	/// ИД группы тревог.
	/// </summary>
	public AlarmScopeId AlarmScopeId { get; } = null!;

	/// <summary>
	/// Группа тревог.
	/// </summary>
	public AlarmScope AlarmScope { get; } = null!;

	/// <summary>
	/// Пункты проверки.
	/// </summary>
	public List<CheckListItem> Items { get; } = [];

	/// <summary>
	/// Создать проверку.
	/// </summary>
	/// <param name="templateId">ИД шаблона проверки.</param>
	/// <param name="alarmScopeId">ИД группы тревог.</param>
	/// <returns>Проверка.</returns>
	public static CheckList Create(CheckListTemplateId templateId, AlarmScopeId alarmScopeId)
	{
		return new CheckList(templateId, alarmScopeId);
	}

	private CheckList(CheckListTemplateId templateId, AlarmScopeId alarmScopeId)
	{
		Id = CheckListId.Create(Guid.CreateVersion7());
		TemplateId = templateId;
		AlarmScopeId = alarmScopeId;
	}

	// For EF
	protected CheckList() { }
}
