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

namespace SolutionErp.Infrastructure.Persistence.Configurations;

// EF Mig 38 G-O3 (S37) — Sequence generator cho mã Đề xuất.
// Mirror PurchaseEvaluationCodeSequenceConfiguration pattern.
// PK = Prefix (string) — "DX/2026". LastSeq tăng atomic.
public class ProposalCodeSequenceConfiguration : IEntityTypeConfiguration<ProposalCodeSequence>
{
    public void Configure(EntityTypeBuilder<ProposalCodeSequence> e)
    {
        e.ToTable("ProposalCodeSequences");

        e.HasKey(x => x.Prefix);
        e.Property(x => x.Prefix).HasMaxLength(20);     // "DX/2026" max 7 chars OK
    }
}
