using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using eprintServer.Enums; namespace eprintServer.Entities; public class Order { [Key] public long Id { get; set; } [Column("user_id")] public long UserId { get; set; } [Column("order_date")] public DateTime OrderDate { get; set; } = DateTime.UtcNow; [Column("total_amount")] public decimal TotalAmount { get; set; } [Column("discount")] public decimal Discount { get; set; } = 0; [Column("status")] public OrderStatus Status { get; set; } = OrderStatus.PENDING; [ForeignKey(nameof(UserId))] public User User { get; set; } public ICollection OrderItems { get; set; } = new List(); public ICollection Payments { get; set; } = new List(); [Column("invoice_id")] public long? InvoiceId { get; set; } [Column("thawani_session_id")] public string? ThawaniSessionId { get; set; } [Column("shipping_ref")] public string? ShippingRef { get; set; } [Column("batch_id")] public string? BatchId { get; set; } // For grouping multiple orders [Column("tracking_number")] public string? TrackingNumber { get; set; } [Column("address_id")] public long? AddressId { get; set; } [ForeignKey(nameof(AddressId))] public UserAddress? UserAddress { get; set; } [Column("timestmp")] public DateTime Timestamp { get; set; } = DateTime.UtcNow; }