// src/Webshop.Domain/Entities/Order.cs using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace Webshop.Domain.Entities { public class Order { [Key] public Guid Id { get; set; } = Guid.NewGuid(); [Required] [MaxLength(50)] public string OrderNumber { get; set; } = string.Empty; [ForeignKey(nameof(Customer))] public Guid? CustomerId { get; set; } [MaxLength(256)] [EmailAddress] public string? GuestEmail { get; set; } [MaxLength(20)] [Phone] public string? GuestPhoneNumber { get; set; } [Required] public DateTimeOffset OrderDate { get; set; } = DateTimeOffset.UtcNow; [Required] [MaxLength(50)] public string OrderStatus { get; set; } = string.Empty; [Required] public decimal OrderTotal { get; set; } [Required] public decimal ShippingCost { get; set; } [Required] public decimal TaxAmount { get; set; } [Required] public decimal DiscountAmount { get; set; } [Required] [MaxLength(50)] public string PaymentStatus { get; set; } = string.Empty; [Required] [MaxLength(100)] public string PaymentMethod { get; set; } = string.Empty; [ForeignKey(nameof(PaymentMethodInfo))] public Guid? PaymentMethodId { get; set; } [ForeignKey(nameof(ShippingMethodInfo))] public Guid? ShippingMethodId { get; set; } [MaxLength(255)] public string? TransactionId { get; set; } // << NEUE FELDER HINZUFÜGEN >> [MaxLength(255)] public string? ShippingTrackingNumber { get; set; } public DateTimeOffset? ShippedDate { get; set; } public DateTimeOffset? DeliveredDate { get; set; } // << ENDE NEUE FELDER >> [Required] [ForeignKey(nameof(BillingAddress))] public Guid BillingAddressId { get; set; } [Required] [ForeignKey(nameof(ShippingAddress))] public Guid ShippingAddressId { get; set; } [MaxLength(1000)] public string? CustomerNotes { get; set; } [MaxLength(1000)] public string? AdminNotes { get; set; } // Navigation Properties public virtual Customer? Customer { get; set; } public virtual Address BillingAddress { get; set; } = default!; public virtual Address ShippingAddress { get; set; } = default!; public virtual PaymentMethod? PaymentMethodInfo { get; set; } public virtual ShippingMethod? ShippingMethodInfo { get; set; } public virtual ICollection OrderItems { get; set; } = new List(); } }