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

namespace ClaudeDo.Data.Configuration;

public class PrimeScheduleEntityConfiguration : IEntityTypeConfiguration<PrimeScheduleEntity>
{
    public void Configure(EntityTypeBuilder<PrimeScheduleEntity> builder)
    {
        builder.ToTable("prime_schedules");

        builder.HasKey(s => s.Id);
        builder.Property(s => s.Id).HasColumnName("id").ValueGeneratedNever();

        builder.Property(s => s.StartDate).HasColumnName("start_date").IsRequired();
        builder.Property(s => s.EndDate).HasColumnName("end_date").IsRequired();
        builder.Property(s => s.TimeOfDay).HasColumnName("time_of_day").IsRequired();
        builder.Property(s => s.WorkdaysOnly).HasColumnName("workdays_only").IsRequired().HasDefaultValue(true);
        builder.Property(s => s.Enabled).HasColumnName("enabled").IsRequired().HasDefaultValue(true);
        builder.Property(s => s.LastRunAt).HasColumnName("last_run_at");
        builder.Property(s => s.PromptOverride).HasColumnName("prompt_override");
        builder.Property(s => s.CreatedAt).HasColumnName("created_at").IsRequired();
    }
}
