// EN: TransactionType enumeration configuration.
// VI: Cấu hình TransactionType enumeration.

using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using InventoryService.Domain.AggregatesModel.InventoryAggregate;

namespace InventoryService.Infrastructure.EntityConfigurations;

public class TransactionTypeEntityTypeConfiguration : IEntityTypeConfiguration<TransactionType>
{
    public void Configure(EntityTypeBuilder<TransactionType> builder)
    {
        builder.ToTable("transaction_types");

        builder.HasKey(t => t.Id);
        builder.Property(t => t.Id).HasColumnName("id").ValueGeneratedNever();
        builder.Property(t => t.Name).HasColumnName("name").HasMaxLength(50).IsRequired();

        builder.HasData(
            TransactionType.In,
            TransactionType.Out,
            TransactionType.Adjustment,
            TransactionType.Reserve,
            TransactionType.Release,
            TransactionType.Wastage
        );
    }
}
