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

namespace ERPCore.Infra.Persistence.Configurations;

public sealed class UomConfiguration : IEntityTypeConfiguration<Uom>
{
    public void Configure(EntityTypeBuilder<Uom> builder)
    {
        builder.ToTable("uoms");
        builder.HasKey(u => u.UomId);

        builder.Property(u => u.Name).IsRequired().HasMaxLength(50);
        builder.HasIndex(u => u.Name).IsUnique();
    }
}
