using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using OmsorgCore.Domain.Entities;

namespace OmsorgCore.Infrastructure.Persistence.Configurations;

public class ValueListConfiguration : IEntityTypeConfiguration<ValueList>
{
    public void Configure(EntityTypeBuilder<ValueList> builder)
    {
        builder.ToTable("value_lists");
        builder.HasKey(l => l.Id);
        builder.Property(l => l.Key).IsRequired().HasMaxLength(50);
        builder.Property(l => l.DisplayName).IsRequired().HasMaxLength(100);
        builder.HasIndex(l => l.Key).IsUnique();
    }
}
