using System.Linq.Expressions;

using Monitoring.Core.Domain;

namespace Monitoring.Features.Zones;

/// <summary>
/// Модель площади.
/// </summary>
/// <param name="Id">Идентификатор.</param>
/// <param name="Name">Название.</param>
public record ZoneModel(
	Guid Id,
	int Index,
	string Name,
	string Description,
	Guid AreaId,
	bool HasAlarms,
	bool HasFaults
)
{
	public static readonly Expression<Func<Zone, ZoneModel>> Projection = x => new ZoneModel(
		x.Id.Value,
		x.Index.Value,
		x.Name.Value,
		x.Description.Value,
		x.AreaId.Value,
		x.Alarms.Count != 0,
		x.Faults.Count != 0);
}