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

namespace Workflow.Infrastructure.Persistence.Configurations;

public class WorkflowEdgeConfiguration : IEntityTypeConfiguration<WorkflowEdge>
{
    public void Configure(EntityTypeBuilder<WorkflowEdge> builder)
    {
        builder.ToTable("wf_workflow_edges");

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

        builder.Property(e => e.SourceNodeId).HasMaxLength(500);
        builder.Property(e => e.TargetNodeId).HasMaxLength(500);
        builder.Property(e => e.Label).HasMaxLength(500);
        builder.Property(e => e.Condition).HasColumnType("jsonb");
    }
}
