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

namespace APT.BaseData.Data.Mapping.FM
{

	public class FMBaseConfigMap : APTEntityBaseMap<T_FM_BASE_CONFIG>
    {
		public override void Configure(EntityTypeBuilder<T_FM_BASE_CONFIG> builder)
		{
			base.Configure(builder);
            builder.Property(t => t.CODE).HasMaxLength(30);
			builder.Property(t => t.NAME).HasMaxLength(30);
            builder.Property(t => t.TEL).HasMaxLength(30);
            //builder.Property(t => t.SN_RULE_EXPRESS).HasMaxLength(300);

            //站点参数
            builder.Property(t => t.LOGO_ID).IsRequired(false);
            builder.HasOne(t => t.Nav_PictureLogo).WithMany().HasForeignKey(t => t.LOGO_ID).IsRequired(false).OnDelete(DeleteBehavior.Restrict);
            builder.Property(t => t.BACK_PIC_ID).IsRequired(false);
            builder.HasOne(t => t.Nav_PictureBg).WithMany().HasForeignKey(t => t.BACK_PIC_ID).IsRequired(false).OnDelete(DeleteBehavior.Restrict);
            builder.HasOne(t => t.Nav_HMI).WithMany().HasForeignKey(t => t.CURRENT_VOLTAGE_HMI_ID).IsRequired(false).OnDelete(DeleteBehavior.Restrict);
            builder.HasOne(t => t.Nav_HomeHmi).WithMany().HasForeignKey(t => t.HOME_HMI_ID).IsRequired(false).OnDelete(DeleteBehavior.Restrict);
            builder.HasOne(t => t.Nav_MessageTemplate).WithMany().HasForeignKey(t => t.MESSAGE_TEMPLATE_ID).IsRequired(false).OnDelete(DeleteBehavior.Restrict);
            builder.Property(t => t.SYS_NAME).HasMaxLength(50);
            builder.Property(t => t.SLOGAN).HasMaxLength(60);
            builder.Property(t => t.PIC_PATH).HasMaxLength(50);
            builder.Property(t => t.FILE_PATH).HasMaxLength(50);
            builder.Property(t => t.PIC_LEN);
            builder.Property(t => t.FILE_LEN);
            builder.Property(t => t.STATISTICAL_TYPE);
            builder.Property(t => t.PIC_TYPE).HasMaxLength(30);
            builder.Property(t => t.FILE_TYPE).HasMaxLength(100);
            builder.Property(t => t.EXCEL_TYPE).HasMaxLength(30);
            builder.Property(t => t.IS_USER_LOG);
            builder.Property(t => t.PUSH_API_URL).HasMaxLength(100);
            builder.Property(t => t.MAP_KEY).HasMaxLength(200);
            builder.HasOne(t => t.Nav_ConsPicture).WithMany().HasForeignKey(t => t.APP_CONS_PICTURE_ID).IsRequired(false).OnDelete(DeleteBehavior.Restrict);
            builder.HasOne(t => t.Nav_TopPicture).WithMany().HasForeignKey(t => t.T0P_PICTURE_ID).IsRequired(false).OnDelete(DeleteBehavior.Restrict);
            builder.HasOne(t => t.Nav_LowPicture).WithMany().HasForeignKey(t => t.LOWER_PICTURE_ID).IsRequired(false).OnDelete(DeleteBehavior.Restrict);
        }
		 
    }
}
