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 PFFormMap : APTEntityBaseMap<T_PF_FORM>
	{
		public override void Configure(EntityTypeBuilder<T_PF_FORM> builder)
		{
			base.Configure(builder);
			builder.Property(t => t.CODE).HasMaxLength(100);
			builder.Property(t => t.NAME).HasMaxLength(100);
            builder.Property(t => t.NAME_ACRONYM).HasMaxLength(200);
			builder.Property(t => t.JS_FILES).HasMaxLength(600);
			builder.Property(t => t.URI).HasMaxLength(200);
			builder.Property(t => t.CUSTOM_PARAMS).HasMaxLength(600); 
			builder.Property(t => t.TABLE_NAME).HasMaxLength(200);
			builder.Property(t => t.REMARK).HasMaxLength(400);
            builder.Property(t => t.AUTH_ORG_CODES).HasMaxLength(200);


			//fk
			builder.HasMany(t=>t.Nav_HomeCharts).WithOne().HasForeignKey(t=>t.PAGE_FORM_ID).OnDelete(DeleteBehavior.Restrict);
			builder.HasMany(t => t.Nav_HomeRankings).WithOne().HasForeignKey(t => t.PAGE_FORM_ID).OnDelete(DeleteBehavior.Restrict);
			builder.HasMany(t => t.Nav_HomeStatistics).WithOne().HasForeignKey(t => t.PAGE_FORM_ID).OnDelete(DeleteBehavior.Restrict);
			builder.HasMany(t => t.Nav_HomeHmis).WithOne().HasForeignKey(t => t.PAGE_FORM_ID).OnDelete(DeleteBehavior.Restrict);
			builder.Property(t => t.ICON)
				   .HasMaxLength(50);
		}
		 
	}
}