using ClaudeDo.Data.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace ClaudeDo.Data.Configuration;

public class WeekReportEntityConfiguration : IEntityTypeConfiguration<WeekReportEntity>
{
    public void Configure(EntityTypeBuilder<WeekReportEntity> builder)
    {
        builder.ToTable("week_reports");
        builder.HasKey(r => r.Id);
        builder.Property(r => r.Id).HasColumnName("id").ValueGeneratedNever();
        builder.Property(r => r.StartDate).HasColumnName("start_date").IsRequired();
        builder.Property(r => r.EndDate).HasColumnName("end_date").IsRequired();
        builder.Property(r => r.Markdown).HasColumnName("markdown").IsRequired();
        builder.Property(r => r.GeneratedAt).HasColumnName("generated_at").IsRequired();
        builder.HasIndex(r => new { r.StartDate, r.EndDate }).IsUnique();
    }
}
