using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using SolutionErp.Domain.Office;

namespace SolutionErp.Infrastructure.Persistence.Configurations;

// EF Mig 41 P11-A (Phase 11) — Sequence generator dùng chung cho mã đơn từ 4
// WorkflowApps module (Leave/OT/Travel/VehicleBooking). Mirror
// ProposalCodeSequenceConfiguration pattern. PK = Prefix (string), LastSeq atomic.
public class WorkflowAppCodeSequenceConfiguration : IEntityTypeConfiguration<WorkflowAppCodeSequence>
{
    public void Configure(EntityTypeBuilder<WorkflowAppCodeSequence> e)
    {
        e.ToTable("WorkflowAppCodeSequences");

        e.HasKey(x => x.Prefix);
        e.Property(x => x.Prefix).HasMaxLength(20);     // "DT/LR/2026" max ~10 chars OK
    }
}
