// EN: OrderStatus enumeration entity configuration.
// VI: Cấu hình entity cho OrderStatus enumeration.

using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using OrderService.Domain.AggregatesModel.OrderAggregate;

namespace OrderService.Infrastructure.EntityConfigurations;

/// <summary>
/// EN: EF Core configuration for OrderStatus enumeration.
/// VI: Cấu hình EF Core cho OrderStatus enumeration.
/// </summary>
public class OrderStatusEntityTypeConfiguration : IEntityTypeConfiguration<OrderStatus>
{
    public void Configure(EntityTypeBuilder<OrderStatus> builder)
    {
        builder.ToTable("order_statuses");

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

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

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

        // EN: Seed data for OrderStatus
        // VI: Dữ liệu seed cho OrderStatus
        builder.HasData(
            OrderStatus.Draft,
            OrderStatus.Validated,
            OrderStatus.Paid,
            OrderStatus.Processing,
            OrderStatus.Completed,
            OrderStatus.Cancelled,
            OrderStatus.PaymentPending
        );
    }
}
