package com.yunfeiyun.agmp.common.core.domain.entity;

import java.util.ArrayList;
import java.util.List;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import com.yunfeiyun.agmp.common.core.domain.BaseEntity;
import com.yunfeiyun.agmp.common.core.domain.model.IBaseMenu;
import com.yunfeiyun.agmp.common.web.system.domain.SysMenuConfig;
import com.yunfeiyun.agmp.common.annotation.Excel;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

/**
 * 菜单权限表 sysMenu
 *
 * @author 杨晓辉
 */
public class SysMenu extends BaseEntity implements IBaseMenu
{
    private static final long serialVersionUID = 1L;

    /** 菜单ID */
    private String menuId;

    /** 菜单名称 */
    private String menuName;

    /** 父菜单名称 */
    private String parentName;

    /** 父菜单ID */
    private String menuParentid;

    /** 显示顺序 */
    private String menuSeq;

    /** 路由地址 */
    private String menuPath;

    /** 组件路径 */
    private String menuComponent;

    /** 路由参数 */
    private String menuQuery;

    /** 是否为外链（0是 1否） */
    private String menuOpentype;


    /** 类型（M目录 C菜单 F按钮） */
    private String menuType;

    /** 显示状态（0显示 1隐藏） */
    private String menuVisiblestatus;

    /** 状态（0显示 1隐藏） */
    private String menuStatus;

    /** 权限字符串 */
    private String menuPerms;

    /** 菜单图标 */
    private String menuIcon;


    /** 菜单创建者 */
    @Excel(name = "菜单创建者")
    private String menuCreator;

    /** 菜单创建时间 */
    @Excel(name = "菜单创建时间")
    private String menuCreateddate;

    /** 菜单更新者 */
    @Excel(name = "菜单更新者")
    private String menuModifier;

    /** 菜单更新时间 */
    @Excel(name = "菜单更新时间")
    private String menuModifieddate;

    /** 菜单备注 */
    @Excel(name = "菜单备注")
    private String menuRemark;

    /** 菜单级层编码 */
    @Excel(name = "菜单级层编码")
    private String menuLevelcode;


    /** 菜单祖籍标签 */
    @Excel(name = "菜单祖籍标签")
    private String menuAncestorlabel;


    /** 系统可用标签 */
    @Excel(name = "系统可用标签")
    private boolean menuSystemEnabled;

    /** 菜单的接口状态 */
    @Excel(name = "菜单的接口状态")
    private String menuApistatus;

    /** 菜单的i系统Id */
    @Excel(name = "菜单的i系统Id")
    private String menuSystemId;

    /** 子菜单 */
    private List<IBaseMenu> children = new ArrayList<IBaseMenu>();

    public SysMenu()
    {
        setMenuId(getId());
    }


    public SysMenu(SysMenuConfig cfg)
    {
        this.menuId = cfg.getMenuId() == null ? cfg.getMenucfgId() :  cfg.getMenuId();
        this.menuParentid = cfg.getMenucfgSys();
        this.menuType = "-1";
        this.menuName = cfg.getSysName() == null ? cfg.getMenucfgSys() : cfg.getSysName();
        this.menuSystemEnabled = cfg.isMenucfgEnabled();
        this.children = new ArrayList<>();
    }

    public String getMenuId()
    {
        return menuId;
    }

    public void setMenuId(String menuId)
    {
        this.menuId = menuId;
    }

    @NotBlank(message = "菜单名称不能为空")
    @Size(min = 0, max = 50, message = "菜单名称长度不能超过50个字符")
    public String getMenuName()
    {
        return menuName;
    }

    public void setMenuName(String menuName)
    {
        this.menuName = menuName;
    }

    public String getParentName()
    {
        return parentName;
    }

    public void setParentName(String parentName)
    {
        this.parentName = parentName;
    }

    public String getMenuParentid()
    {
        return menuParentid;
    }

    public void setMenuParentid(String menuParentid)
    {
        this.menuParentid = menuParentid;
    }

    @NotNull(message = "显示顺序不能为空")
    public String getMenuSeq()
    {
        return menuSeq;
    }

    public void setMenuSeq(String menuSeq)
    {
        this.menuSeq = menuSeq;
    }

    @Size(min = 0, max = 200, message = "路由地址不能超过200个字符")
    public String getMenuPath()
    {
        return menuPath;
    }

    public void setMenuPath(String menuPath)
    {
        this.menuPath = menuPath;
    }

    @Size(min = 0, max = 200, message = "组件路径不能超过255个字符")
    public String getMenuComponent()
    {
        return menuComponent;
    }

    public void setMenuComponent(String menuComponent)
    {
        this.menuComponent = menuComponent;
    }

    public String getMenuQuery()
    {
        return menuQuery;
    }

    public void setMenuQuery(String menuQuery)
    {
        this.menuQuery = menuQuery;
    }

    public String getMenuOpentype()
    {
        return menuOpentype;
    }

    public void setMenuOpentype(String menuOpentype)
    {
        this.menuOpentype = menuOpentype;
    }


    @NotBlank(message = "菜单类型不能为空")
    public String getMenuType()
    {
        return menuType;
    }

    public void setMenuType(String menuType)
    {
        this.menuType = menuType;
    }

    public String getMenuVisiblestatus()
    {
        return menuVisiblestatus;
    }

    public void setMenuVisiblestatus(String menuVisiblestatus)
    {
        this.menuVisiblestatus = menuVisiblestatus;
    }

    public String getMenuStatus()
    {
        return menuStatus;
    }

    public void setMenuStatus(String menuStatus)
    {
        this.menuStatus = menuStatus;
    }


    @Size(min = 0, max = 100, message = "权限标识长度不能超过100个字符")
    public String getMenuPerms()
    {
        return menuPerms;
    }

    public void setMenuPerms(String menuPerms)
    {
        this.menuPerms = menuPerms;
    }

    public String getMenuIcon()
    {
        return menuIcon;
    }

    public void setMenuIcon(String menuIcon)
    {
        this.menuIcon = menuIcon;
    }

    public List<IBaseMenu> getChildren()
    {
        return children;
    }

    public void setChildren(List<IBaseMenu> children)
    {
        this.children = children;
    }

    public String getMenuCreator()
    {
        return menuCreator;
    }

    public void setMenuCreator(String menuCreator)
    {
        this.menuCreator = menuCreator;
    }

    public String getMenuCreateddate()
    {
        return menuCreateddate;
    }

    public void setMenuCreateddate(String menuCreateddate)
    {
        this.menuCreateddate = menuCreateddate;
    }

    public String getMenuModifier()
    {
        return menuModifier;
    }

    public void setMenuModifier(String menuModifier)
    {
        this.menuModifier = menuModifier;
    }

    public String getMenuModifieddate()
    {
        return menuModifieddate;
    }

    public void setMenuModifieddate(String menuModifieddate)
    {
        this.menuModifieddate = menuModifieddate;
    }

    public String getMenuRemark()
    {
        return menuRemark;
    }

    public void setMenuRemark(String menuRemark)
    {
        this.menuRemark = menuRemark;
    }

    public String getMenuLevelcode(){
        return this.menuLevelcode;
    }
    public void setMenuLevelcode(String menuLevelcode){
        this.menuLevelcode = menuLevelcode;
    }

    public String getMenuAncestorlabel() {
        return menuAncestorlabel;
    }

    public void setMenuAncestorlabel(String menuAncestorlabel) {
        this.menuAncestorlabel = menuAncestorlabel;
    }

    @Override
    public String getMenuSystemId() {
        return menuSystemId;
    }

    @Override
    public void setMenuSystemId(String menuSystemId) {
        this.menuSystemId = menuSystemId;
    }

    public boolean getMenuSystemEnabled() {
        return menuSystemEnabled;
    }

    public void setMenuSystemEnabled(boolean menuSystemEnabled) {
        this.menuSystemEnabled = menuSystemEnabled;
    }

    @Override
    public String getMenuApistatus() {
        return menuApistatus;
    }

    @Override
    public void setMenuApistatus(String menuApistatus) {
        this.menuApistatus = menuApistatus;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
                .append("menuId", getMenuId())
                .append("menuName", getMenuName())
                .append("menuParentid", getMenuParentid())
                .append("menuSeq", getMenuSeq())
                .append("menuPath", getMenuPath())
                .append("menuComponent", getMenuComponent())
                .append("menuOpentype", getMenuOpentype())
                .append("menuType", getMenuType())
                .append("menuVisiblestatus", getMenuVisiblestatus())
                .append("menuStatus", getMenuStatus())
                .append("menuApistatus", getMenuApistatus())
                .append("menuPerms", getMenuPerms())
                .append("menuIcon", getMenuIcon())
                .append("menuCreator", getMenuCreator())
                .append("menuCreateddate", getMenuCreateddate())
                .append("menuModifier", getMenuModifier())
                .append("menuModifieddate", getMenuModifieddate())
                .append("menuRemark", getMenuRemark())
                .append("menuLevelcode", getMenuLevelcode())
                .toString();
    }
}
