using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using MembershipService.Domain.AggregatesModel.MemberAggregate;

namespace MembershipService.Infrastructure.EntityConfigurations;

/// <summary>
/// EN: Entity configuration for MembershipLevel enumeration.
/// VI: Cấu hình entity cho MembershipLevel enumeration.
/// </summary>
public class MembershipLevelEntityTypeConfiguration : IEntityTypeConfiguration<MembershipLevel>
{
    public void Configure(EntityTypeBuilder<MembershipLevel> builder)
    {
        builder.ToTable("membership_levels");

        builder.HasKey(ml => ml.Id);

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

        builder.Property(ml => ml.Name)
            .HasColumnName("name")
            .HasMaxLength(50)
            .IsRequired();
    }
}
