using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using WhatsAppService.Domain.AggregatesModel.SampleAggregate;

namespace WhatsAppService.Infrastructure.EntityConfigurations;

/// <summary>
/// EN: EF Core configuration for SampleStatus enumeration.
/// VI: Cấu hình EF Core cho enumeration SampleStatus.
/// </summary>
public class SampleStatusEntityTypeConfiguration : IEntityTypeConfiguration<SampleStatus>
{
    public void Configure(EntityTypeBuilder<SampleStatus> builder)
    {
        // EN: Table name / VI: Tên bảng
        builder.ToTable("sample_statuses");

        // EN: Primary key / VI: Khóa chính
        builder.HasKey(s => s.Id);

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

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

        // EN: Seed initial data / VI: Seed dữ liệu ban đầu
        builder.HasData(
            SampleStatus.Draft,
            SampleStatus.Active,
            SampleStatus.Completed,
            SampleStatus.Cancelled
        );
    }
}
