34 lines
1.0 KiB
C#
34 lines
1.0 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
using LittleShop.Enums;
|
|
|
|
namespace LittleShop.Models;
|
|
|
|
public class ProductVariant
|
|
{
|
|
[Key]
|
|
public Guid Id { get; set; }
|
|
|
|
public Guid ProductId { get; set; }
|
|
|
|
[Required]
|
|
[StringLength(100)]
|
|
public string Name { get; set; } = string.Empty; // e.g., "Red", "Blue", "Vanilla", "Chocolate"
|
|
|
|
[StringLength(50)]
|
|
public string VariantType { get; set; } = "Standard"; // e.g., "Color", "Flavor", "Size", "Standard"
|
|
|
|
public int SortOrder { get; set; } = 0; // For controlling display order
|
|
|
|
public bool IsActive { get; set; } = true;
|
|
|
|
public int StockLevel { get; set; } = 0; // Optional: track stock per variant
|
|
|
|
public decimal? Price { get; set; } // Optional: override product price for this variant (if null, uses product.Price)
|
|
|
|
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
|
|
|
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
|
|
|
// Navigation properties
|
|
public virtual Product Product { get; set; } = null!;
|
|
} |