using Domain.Entities.Donations; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace Infrastructure.Persistence.Configurations.Donations; public sealed class ChannelTitleConfiguration : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) { builder.HasOne(x => x.Channel).WithMany().HasForeignKey(x => x.ChannelID).OnDelete(DeleteBehavior.Cascade); builder.ToTable(nameof(ChannelTitle), x => x.HasComment("채널별 칭호 (크리에이터 설정)")); builder.HasKey(x => x.ID); builder.Property(x => x.ID).ValueGeneratedOnAdd(); builder.Property(x => x.ChannelID).IsRequired().HasComment("채널 ID"); builder.Property(x => x.Name).HasMaxLength(20).IsRequired().HasComment("칭호 이름"); builder.Property(x => x.Description).HasMaxLength(100).HasComment("칭호 설명"); builder.Property(x => x.MinAmount).IsRequired().HasComment("획득 조건 (누적 후원 최소 금액)"); builder.Property(x => x.Color).HasMaxLength(20).IsRequired().HasComment("칭호 색상 (hex)"); builder.Property(x => x.IconUrl).HasMaxLength(500).HasComment("칭호 아이콘 URL"); builder.Property(x => x.SortOrder).IsRequired().HasComment("정렬 순서"); builder.Property(x => x.IsActive).IsRequired().HasComment("활성 여부"); builder.Property(x => x.UpdatedAt).HasComment("수정 일시"); builder.Property(x => x.CreatedAt).IsRequired().HasComment("생성 일시"); builder.HasIndex(x => new { x.ChannelID, x.SortOrder }); builder.HasIndex(x => new { x.ChannelID, x.MinAmount }); } }