using APT.BaseData.Domain.Entities;
using APT.Infrastructure.EF.Map;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace APT.BaseData.Data.Mapping
{
    public class PFEditColumnMap : APTEntityBaseMap<T_PF_EDIT_COLUMN>
    {
        public override void Configure(EntityTypeBuilder<T_PF_EDIT_COLUMN> builder)
        {
            base.Configure(builder);

            builder.Property(t => t.CODE).HasMaxLength(200);
            builder.Property(t => t.FIELD_NAME)
               .HasMaxLength(100);
            builder.Property(t => t.LABEL)
              .HasMaxLength(64);
            builder.Property(t => t.ENUM)
               .HasMaxLength(64);
            builder.Property(t => t.TYPE_NAME)
            .HasMaxLength(64);
            builder.Property(t => t.VALIDATA_TYPE)
            .HasMaxLength(5);
            builder.Property(t => t.FORMAT)
              .HasMaxLength(60);
            builder.Property(t => t.QUERY_FORMAT)
          .HasMaxLength(60);
            builder.Property(t => t.INPUT_DATA_API)
            .HasMaxLength(64);
            builder.Property(t => t.INPUT_SORT_FIELD)
            .HasMaxLength(100);
            builder.Property(t => t.INPUT_SORT_ORDER)
            .HasMaxLength(50);
            builder.Property(t => t.INPUT_FILTER_FIELD)
          .HasMaxLength(600);
            builder.Property(t => t.INPUT_SHOW_FIELD)
          .HasMaxLength(600);
            builder.Property(t => t.VERIFY_MSG)
                .HasMaxLength(50);
            builder.Property(t => t.INPUT_LABEL_FIELD)
            .HasMaxLength(600);
            builder.Property(t => t.INPUT_SAVE_FIELD)
            .HasMaxLength(600);
            builder.Property(t => t.INPUT_NAV_FIELD)
            .HasMaxLength(600);
            builder.Property(t => t.SELECTD_LABEL_FIELD)
      .HasMaxLength(50);

            builder.Property(t => t.INPUT_SORT_FIELD)
            .HasMaxLength(600);
            builder.Property(t => t.INPUT_SORT_ORDER)
            .HasMaxLength(600);

            builder.Property(t => t.DEFAULT_VALUE).HasMaxLength(50);
            builder.Property(t => t.REMARK).HasMaxLength(80);
            builder.Property(t => t.SHOW_FORM_CODE).HasMaxLength(60);
            builder.Property(t => t.SHOW_ID_FIELD).HasMaxLength(500);
            builder.Property(t => t.EDIT_FORM_CODE).HasMaxLength(60);
            builder.Property(t => t.EDIT_FORM_FILTER).HasMaxLength(30);
            builder.Property(t => t.EDIT_FORM_FILTER_VALUE).HasMaxLength(30);
            builder.Property(t => t.PROMPT_INFO).HasMaxLength(50);
            builder.Property(t => t.VERIFY_EXPRESS).HasMaxLength(100);
            builder.Property(t => t.INPUT_ID_FIELD).HasMaxLength(200);

            builder.HasOne(t => t.Nav_PageEditPanel).WithMany().HasForeignKey(t => t.PAGE_EDIT_PANEL_ID).OnDelete(DeleteBehavior.Restrict);

            builder.Property(t => t.VERIFY_ERROR_INFO).HasMaxLength(200);
        }
    }
}
