55 lines
1.4 KiB
C#
55 lines
1.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
namespace Webshop.Domain.Entities;
|
|
|
|
/// <summary>
|
|
/// Verwaltung von Rabatten auf Produkte oder Kategorien.
|
|
/// </summary>
|
|
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<ProductDiscount> ProductDiscounts { get; set; } = new List<ProductDiscount>();
|
|
public virtual ICollection<CategoryDiscount> CategoryDiscounts { get; set; } = new List<CategoryDiscount>();
|
|
} |