using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace Fitness_core_BE.Models { /// A stocked item sold at the gym (snacks, supplements, merchandise). QuantityOnHand /// is a maintained running balance -- adjusted by GoodsReceivedNoteItem (+), SaleItem (-) and /// StockReturn (-) -- not computed from those tables on every read. public class Product { [Key] public Guid ProductId { get; set; } public Guid FKClientId { get; set; } [ForeignKey(nameof(FKClientId))] public Client Client { get; set; } [MaxLength(128)] public string Name { get; set; } = string.Empty; [MaxLength(64)] public string? Sku { get; set; } /// Relative /Uploads path to the product's photo (same convention as /// ClientBusiness.BusinessLogoId) -- null when no image has been uploaded. [MaxLength(300)] public string? ImageId { get; set; } [MaxLength(20)] public string UnitOfMeasure { get; set; } = "pcs"; /// Set from the most recent GRN line's UnitCost -- a simple latest-cost /// approach, not a weighted average. public decimal CostPrice { get; set; } = 0m; public decimal SellingPrice { get; set; } = 0m; public decimal QuantityOnHand { get; set; } = 0m; public bool IsActive { get; set; } = true; public DateTime CreatedAt { get; set; } = DateTime.UtcNow; } }