package com.hys.app.model.system.vo;

import com.hys.app.model.system.enums.MenuTypeEnum;
import io.swagger.annotations.ApiModelProperty;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.Serializable;


/**
 * 菜单VO
 *
 * @author zh
 * @version v7.0.0
 * @since v7.0.0
 * 2018-06-19 11:13:31
 */
public class MenuVO implements Serializable {

    private static final long serialVersionUID = 9663234630434717L;

    /**
     * 父id
     */
    @NotNull(message = "父菜单id不能为空")
    @Min(message = "父菜单必须为数字且不能为负数", value = 0)
    @ApiModelProperty(name = "parent_id", value = "父菜单id，如果为顶级菜单传0即可")
    private Long parentId;
    /**
     * 菜单标题
     */
    @NotEmpty(message = "菜单标题不能为空")
    @ApiModelProperty(name = "title", value = "菜单标题")
    private String title;
    /**
     * 菜单url
     */
    @ApiModelProperty(name = "url", value = "菜单链接")
    private String url;

    /**
     * 菜单url
     */
    @ApiModelProperty(name = "show_home", value = "是否首页显示")
    private Short showHome;

    /**
     * 菜单url
     */
    @ApiModelProperty(name = "icon", value = "菜单图标")
    private String icon;
    /**
     * 菜单唯一标识
     */
    @NotEmpty(message = "菜单唯一标识不能为空")
    @ApiModelProperty(name = "identifier", value = "菜单唯一标识")
    private String identifier;
    /**
     * 权限表达式
     */
    @NotEmpty(message = "权限表达式不能为空")
    @ApiModelProperty(name = "auth_regular", value = "权限表达式")
    private String authRegular;

    @ApiModelProperty(name = "type", value = "菜单类型", required = false)
    private MenuTypeEnum type;


    public void setShowHome(Short showHome) {
        this.showHome = showHome;
    }

    public Short getShowHome() {
        return showHome;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

    public String getIcon() {
        return icon;
    }

    public Long getParentId() {
        return parentId;
    }

    public void setParentId(Long parentId) {
        this.parentId = parentId;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getIdentifier() {
        return identifier;
    }

    public void setIdentifier(String identifier) {
        this.identifier = identifier;
    }

    public String getAuthRegular() {
        return authRegular;
    }

    public void setAuthRegular(String authRegular) {
        this.authRegular = authRegular;
    }

    public MenuTypeEnum getType() {
        return type;
    }

    public void setType(MenuTypeEnum type) {
        this.type = type;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        MenuVO that = (MenuVO) o;

        if (parentId != null ? !parentId.equals(that.parentId) : that.parentId != null) {
            return false;
        }
        if (title != null ? !title.equals(that.title) : that.title != null) {
            return false;
        }
        if (url != null ? !url.equals(that.url) : that.url != null) {
            return false;
        }
        if (identifier != null ? !identifier.equals(that.identifier) : that.identifier != null) {
            return false;
        }
        return authRegular != null ? authRegular.equals(that.authRegular) : that.authRegular == null;
    }

    @Override
    public int hashCode() {
        int result = 0;
        result = 31 * result + (parentId != null ? parentId.hashCode() : 0);
        result = 31 * result + (title != null ? title.hashCode() : 0);
        result = 31 * result + (url != null ? url.hashCode() : 0);
        result = 31 * result + (identifier != null ? identifier.hashCode() : 0);
        result = 31 * result + (authRegular != null ? authRegular.hashCode() : 0);
        return result;
    }

    @Override
    public String toString() {
        return "MenuVO{" +
                ", parentId=" + parentId +
                ", title='" + title + '\'' +
                ", url='" + url + '\'' +
                ", identifier='" + identifier + '\'' +
                ", authRegular='" + authRegular + '\'' +
                '}';
    }


}
