using Heimdall.Domain.Entities; using Heimdall.Domain.Enums; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace Heimdall.Infrastructure.Data.Configurations; public class NotificationTemplateConfiguration : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) { builder.ToTable("notification_templates"); builder.HasKey(t => t.Id); builder.Property(t => t.EventType) .HasConversion() .HasMaxLength(50) .IsRequired(); builder.Property(t => t.Channel) .HasConversion() .HasMaxLength(50) .IsRequired(); builder.Property(t => t.Language) .HasMaxLength(10) .IsRequired() .HasDefaultValue("fr"); builder.Property(t => t.Subject) .HasMaxLength(200) .IsRequired(); builder.Property(t => t.BodyMarkdown) .IsRequired(); builder.Property(t => t.CreatedAt) .HasDefaultValueSql("NOW()"); builder.Property(t => t.UpdatedAt) .HasDefaultValueSql("NOW()"); // Indexes builder.HasIndex(t => new { t.EventType, t.Channel, t.Language }).IsUnique(); } }