using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; namespace Webshop.Domain.Entities; /// /// Verwaltung von Rabatten auf Produkte oder Kategorien. /// public class Discount { [Key] public Guid Id { get; set; } [Required] [MaxLength(255)] public string Name { get; set; } [Required] [MaxLength(50)] public string DiscountType { get; set; } // "Percentage", "FixedAmount" // Precision wird via Fluent API konfiguriert [Required] public decimal DiscountValue { get; set; } [Required] public DateTimeOffset StartDate { get; set; } public DateTimeOffset? EndDate { get; set; } [Required] public bool IsActive { get; set; } [Required] public bool RequiresCouponCode { get; set; } // Unique-Constraint wird via Fluent API konfiguriert [MaxLength(50)] public string? CouponCode { get; set; } public decimal? MinimumOrderAmount { get; set; } public int? MaximumUsageCount { get; set; } [Required] public int CurrentUsageCount { get; set; } [MaxLength(1000)] public string? Description { get; set; } // Navigation Properties public virtual ICollection ProductDiscounts { get; set; } = new List(); public virtual ICollection categorieDiscounts { get; set; } = new List(); }