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

namespace SportsDivision.Infrastructure.Data.Configurations;

public class ZoneConfiguration : IEntityTypeConfiguration<Zone>
{
    public void Configure(EntityTypeBuilder<Zone> builder)
    {
        builder.HasKey(z => z.ZoneId);
        builder.Property(z => z.Name).IsRequired().HasMaxLength(100);
        builder.Property(z => z.Code).IsRequired().HasMaxLength(10);
        builder.HasIndex(z => z.Code).IsUnique();
    }
}
