using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Workflow.Domain.Entities;

namespace Workflow.Infrastructure.Persistence.Configurations;

public class FormDataConfiguration : IEntityTypeConfiguration<FormData>
{
    public void Configure(EntityTypeBuilder<FormData> builder)
    {
        builder.ToTable("wf_form_data");

        builder.HasKey(e => e.Id);
        builder.Property(e => e.Id).ValueGeneratedNever();

        builder.Property(e => e.DataJson).HasColumnType("jsonb");

        builder.HasIndex(e => e.InstanceId);
    }
}
