using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using LittleShop.Enums; namespace LittleShop.Models; public class Order { [Key] public Guid Id { get; set; } // Customer Information (nullable for transition period) public Guid? CustomerId { get; set; } // Legacy identity reference (still used for anonymous orders) [StringLength(100)] public string? IdentityReference { get; set; } public OrderStatus Status { get; set; } = OrderStatus.PendingPayment; [Column(TypeName = "decimal(18,2)")] public decimal TotalAmount { get; set; } [StringLength(10)] public string Currency { get; set; } = "GBP"; // Shipping Information [Required] [StringLength(200)] public string ShippingName { get; set; } = string.Empty; [Required] [StringLength(500)] public string ShippingAddress { get; set; } = string.Empty; [Required] [StringLength(100)] public string ShippingCity { get; set; } = string.Empty; [Required] [StringLength(20)] public string ShippingPostCode { get; set; } = string.Empty; [Required] [StringLength(100)] public string ShippingCountry { get; set; } = "United Kingdom"; [StringLength(500)] public string? Notes { get; set; } [StringLength(100)] public string? TrackingNumber { get; set; } public DateTime CreatedAt { get; set; } = DateTime.UtcNow; public DateTime UpdatedAt { get; set; } = DateTime.UtcNow; public DateTime? PaidAt { get; set; } public DateTime? ShippedAt { get; set; } // Navigation properties public virtual Customer? Customer { get; set; } public virtual ICollection Items { get; set; } = new List(); public virtual ICollection Payments { get; set; } = new List(); }