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

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

namespace InventoryService.Infrastructure.EntityConfigurations;

public class ItemTypeEntityTypeConfiguration : IEntityTypeConfiguration<ItemType>
{
    public void Configure(EntityTypeBuilder<ItemType> builder)
    {
        builder.ToTable("item_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(
            ItemType.RawMaterial,
            ItemType.FinishedGood,
            ItemType.Consumable
        );
    }
}
