namespace LiteCharms.Features.MidrandBooks.Products.Entities; public sealed class ProductInventoryConfiguration : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) { builder.ToTable("Inventories"); builder.HasKey(f => f.Id); builder.Property(f => f.CreatedAt).IsRequired().ValueGeneratedOnAdd().HasDefaultValueSql("now()"); builder.Property(f => f.Status).IsRequired(); builder.Property(f => f.TotalAllocated).IsRequired(); builder.Property(f => f.TotalReserved).IsRequired(); builder.Property(f => f.ProductId).IsRequired(); builder.Property(f => f.ProductPriceId).IsRequired(); builder.HasOne(f => f.Product) .WithMany() .HasForeignKey(f => f.ProductId) .OnDelete(DeleteBehavior.Cascade); builder.HasOne(f => f.Price) .WithMany() .HasForeignKey(f => f.ProductPriceId) .OnDelete(DeleteBehavior.Cascade); } }