using System.Linq.Expressions;

using Monitoring.Core.Domain.ServiceOrganizationManagement;

namespace Monitoring.Models;

public record ServiceOrganizationModel(
	Guid Id,
	string Name,
	DateTime CreatedAt,
	DateTime UpdatedAt,
	byte[] TimeStamp
)
{
	public static readonly Expression<Func<ServiceOrganization, ServiceOrganizationModel>> Projection =
		organization => new ServiceOrganizationModel(
			organization.Id.Value, 
			organization.Name.Value, 
			organization.CreatedAt,
			organization.UpdatedAt,
			organization.TimeStamp
		);

	public static readonly Func<ServiceOrganization, ServiceOrganizationModel> FromEntity =
		organization => new ServiceOrganizationModel(
			organization.Id.Value,
			organization.Name.Value, 
			organization.CreatedAt,
			organization.UpdatedAt,
			organization.TimeStamp
		);
}