using System.Linq.Expressions;

using Monitoring.Core.Domain.EventManagement;

namespace Monitoring.Models;

public record EventModel(
	Guid Id,
	DateTime CreatedAt,
	Guid AssetId,
	int Code,
	bool IsAlarm,
	int AreaIndex,
	int ZoneIndex
)
{
	public static Expression<Func<Event, EventModel>> FromEntity => entity => new EventModel(
			entity.Id.Value,
			entity.CreatedAt,
			entity.Asset.Id.Value,
			entity.Code.Value.Value,
			entity.Code.IsActive,
			entity.AreaIndex.Value,
			entity.ZoneIndex.Value
		);
}