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 PFQueryMap : APTEntityBaseMap<T_PF_QUERY>
    {

		public override void Configure(EntityTypeBuilder<T_PF_QUERY> builder)
		{
			base.Configure(builder);
			builder.Property(t => t.QUERY_NAME)
			 .HasMaxLength(100);

			builder.Property(t => t.LABEL)
			  .HasMaxLength(64);

			builder.Property(t => t.OP_DEFAULT)
				.HasMaxLength(64);

			builder.Property(t => t.DATA_VALUE)
			 .HasMaxLength(100);

			builder.Property(t => t.ENUM_NAME).HasMaxLength(50);

			builder.Property(t => t.INPUT_DATA_API).HasMaxLength(100);

			builder.Property(t => t.SELECT_CONDITION).HasMaxLength(200);

			builder.HasOne(t => t.Nav_PageForm).WithMany().
				HasForeignKey(t => t.PAGE_FORM_ID);
			builder.Property(t => t.CODE).HasMaxLength(100); 
			builder.HasOne(t => t.Nav_PageFormQuery).
				WithMany(t => t.Nav_Querys).HasForeignKey(t => t.PAGE_FORM_QUERY_ID).OnDelete(DeleteBehavior.Restrict);

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

			builder.Property(t => t.INPUT_ID_FIELD)
.HasMaxLength(50);
			builder.Property(t => t.INPUT_FILTER_FIELD)
		  .HasMaxLength(100);
			builder.Property(t => t.INPUT_SHOW_FIELD)
		  .HasMaxLength(100);
			builder.Property(t => t.INPUT_LABEL_FIELD)
				 .HasMaxLength(100);
			builder.Property(t => t.INPUT_SAVE_FIELD)
				 .HasMaxLength(600);
			builder.Property(t => t.INPUT_NAV_FIELD)
					 .HasMaxLength(600);

			builder.Property(t => t.DATETIME_FORMATE).HasMaxLength(50);

		}


	}
}
