using AgriculturalPlatform.Api.Models; namespace AgriculturalPlatform.Api.Dtos; public record ProductDto( int Id, string Name, string Category, string Unit, string Spec, decimal Price, string Status, DateTime CreatedAt); public record ProductSaveRequest( string Name, string Category, string Unit, string Spec, decimal Price, string Status = "Active"); public static class ProductMappers { public static ProductDto ToDto(this Product p) => new( p.Id, p.Name, p.Category, p.Unit, p.Spec, p.Price, p.Status.ToString(), p.CreatedAt); public static ProductDto[] ToDtos(this IEnumerable items) => items.Select(ToDto).ToArray(); }