namespace LiteCharms.Features.MidrandBooks.Customers.Entities; public class ContactConfiguration : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) { builder.ToTable("Contacts"); builder.HasKey(c => c.Id); builder.Property(c => c.CustomerId).IsRequired(); builder.Property(c => c.CreatedAt).IsRequired().ValueGeneratedOnAdd().HasDefaultValueSql("now()"); builder.Property(c => c.UpdatedAt).HasDefaultValueSql("now()"); builder.Property(c => c.Name).IsRequired(); builder.Property(c => c.LastName).IsRequired(); builder.Property(c => c.Type).IsRequired(); builder.Property(c => c.Phone).IsRequired(); builder.Property(c => c.Email).IsRequired(); builder.Property(c => c.IsPrimary).HasDefaultValue(false); builder.Property(c => c.Enabled).HasDefaultValue(true); builder.HasOne(c => c.Customer) .WithMany(c => c.Contacts) .HasForeignKey(c => c.CustomerId) .OnDelete(DeleteBehavior.Cascade); } }