using APT.BaseData.Domain.Dtos;
using APT.BaseData.Domain.Entities;

using APT.BaseData.Domain.Entities.FM;
using APT.Infrastructure.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace APT.BaseData.Domain.ApiModel
{
	/// <summary>
	/// 用户角色
	/// </summary>
	public class UserRoleModel
	{
		/// <summary>
		/// 
		/// </summary>
		public UserRoleModel()
		{
			this.Roles = new List<T_FM_ROLE>();
		}
		/// <summary>
		/// 用户
		/// </summary>
		public virtual T_FM_USER User { get; set; }
		/// <summary>
		/// 角色
		/// </summary>
		public virtual ICollection<T_FM_ROLE> Roles { get; set; }

		/// <summary>
		/// 角色授权
		/// </summary>
		public virtual RolePerm Nav_RolePerm { get; set; }

        public bool CanMenuRework { get; set; }

	}
	/// <summary>
	/// 登录
	/// </summary>
	public class UserLoginBaseModel : UserRoleModel
	{
		public UserLoginBaseModel()
		{
			this.NeedRemoveCookieKeys = new List<string>();
			//this.Nav_Notifications = new List<NotificationModel>();
		}
		

		public dynamic BaseConfig { get; set; }
		/// <summary>
		/// 用户类型 PFUserTypeEnum
		/// </summary>
		public int UserType { get; set; }

		public int ShowStyle { get; set; }
		/// <summary>
		/// 组织权限
		/// </summary>
		public List<Guid> OrgRule { get; set; }

		/// <summary>
		/// 表单设置版本
		/// </summary>
		public decimal FormConfigVersion { get; set; }


		public virtual ICollection<string> NeedRemoveCookieKeys { get; set; }

		/// <summary>
		/// 通知公告
		/// </summary>
		//public virtual ICollection<NotificationModel> Nav_Notifications { get; set; }
		
	}
	/// <summary>
	/// 登录
	/// </summary>
	public class UserLoginModel: UserLoginBaseModel
	{
		public UserLoginModel()
		{
			//this.Menus = new List<UserLoginMenuModel>();
		}

		/// <summary>
		/// 菜单
		/// </summary>
		//public virtual ICollection<UserLoginMenuModel> Menus { get; set; }

		public virtual IEnumerable<TreeNode<T_PF_MENU>> Menus { get; set; }

		public virtual List<string> DataRule { get; set; }
		//public virtual ICollection<UserLoginMenuModel> Menus { get; set; }


		//public virtual ICollection<T_FM_WORKSTAGE> WorkStages { get; set; }

	}



    /// <summary>登入菜单</summary>
    public class UserLoginMenuModel
	{
		public UserLoginMenuModel()
		{
			this.ChildMenus = new List<UserLoginMenuModel>();
		}
		public T_PF_MENU Menu { get; set; }

		public List<UserLoginMenuModel> ChildMenus { get; set; }
        //public List<T_FM_WORKSTAGE> WorkStages { get; set; }
    }

	/// <summary>
	/// 登录
	/// </summary>
	public class UserClientLoginModel : UserLoginBaseModel
	{


		/// <summary>
		/// 菜单
		/// </summary>
		//public List<UserClientLoginMenuModel> Menus { get; set; }
		public virtual IEnumerable<TreeNode<T_PF_CLIENT_MENU>> Menus { get; set; }
		public T_FM_TEAM Team { get; set; }

		//public List<T_FM_WORKSTAGE> WorkStages { get; set; }
	}



	/// <summary>登入菜单</summary>
	public class UserClientLoginMenuModel
	{
		public UserClientLoginMenuModel()
		{
			this.ChildMenus = new List<UserClientLoginMenuModel>();
		}
		public T_PF_CLIENT_MENU Menu { get; set; }

		public List<UserClientLoginMenuModel> ChildMenus { get; set; }
		 
	}

	/// <summary>
	/// 登录
	/// </summary>
	public class UserAppLoginModel : UserLoginBaseModel
	{
	
		public virtual IEnumerable<TreeNode<T_PF_APPMENU>> Menus { get; set; }
		public virtual List<string> DataRule { get; set; }//数据权限
		/// <summary>
		/// 菜单
		/// </summary>
		//public List<UserAppLoginMenuModel> Menus { get; set; }

		//public List<T_FM_WORKSTAGE> WorkStages { get; set; }
	}



	/// <summary>登入菜单</summary>
	public class UserAppLoginMenuModel
	{
		public UserAppLoginMenuModel()
		{
			this.ChildMenus = new List<UserAppLoginMenuModel>();
		}
		public T_PF_APPMENU Menu { get; set; }


		public List<UserAppLoginMenuModel> ChildMenus { get; set; }

	}

	/// <summary>
	/// 角色授权
	/// </summary>
	public class RolePerm
	{
		public RolePerm()
		{

			this.Nav_RolePermForms = new List<PermMenuDto>();
			this.Nav_RolePermWorkStages = new List<RolePermWorkStage>();
			this.Nav_RolePermPanels = new List<RolePermPanel>();
		}

		/// <summary>
		/// 角色授权表单列表
		/// </summary>
		public virtual ICollection<PermMenuDto> Nav_RolePermForms { get; set; }
		/// <summary>
		/// 角色授权工作中心列表
		/// </summary>
		public virtual ICollection<RolePermWorkStage> Nav_RolePermWorkStages { get; set; }

		/// <summary>
		/// 角色授权区域列表
		/// </summary>
		public virtual ICollection<RolePermPanel> Nav_RolePermPanels { get; set; }
	}


	public class RolePermForm
	{
		public RolePermForm()
		{
			this.Nav_Btns = new List<RolePermFormBtn>();
			this.Nav_Columns = new List<RolePermFormColumn>();
		}

		
		public Guid PermFormId { get; set; }

		public Guid MenuId { get; set; }
		/// <summary>授权页面</summary>
		public virtual T_PF_FORM Nav_PermForm { get; set; }

		/// <summary>
		/// 授权按钮列表
		/// </summary>
		public virtual ICollection<RolePermFormBtn> Nav_Btns { get; set; }

		/// <summary>
		/// 授权列列表
		/// </summary>
		public virtual ICollection<RolePermFormColumn> Nav_Columns { get; set; }

	}

	public class RolePermFormBtn
	{
		public Guid BtnId { get; set; }

		public Guid MenuId { get; set; }

		public virtual T_PF_BTN Nav_Btn { get; set; }
	}

	public class RolePermFormColumn
	{
		public Guid ColumnId { get; set; }

		public Guid MenuId { get; set; }

		public virtual T_PF_COLUMN Nav_Column { get; set; }
	}


	public class RolePermWorkStage
	{
		public Guid WorkstageId { get; set; }

		//public virtual T_FM_WORKSTAGE Nav_WorkStage { get; set; }
	}


	public class RolePermPanel
	{
		public Guid PanelId { get; set; }
		public virtual T_FM_PANEL Nav_Panel { get; set; }
	}

}
