package com.qmth.paper.library.common.bean.result;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.qmth.paper.library.common.enums.PrivilegeEnum;
import com.qmth.paper.library.common.bean.dto.PrivilegeCacheDto;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;
import java.util.List;

/**
 * @Description: 权限result
 * @Param:
 * @return:
 * @Author: wangliang
 * @Date: 2021/3/27
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
public class PrivilegeResult implements Serializable {

    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(value = "主键")
    Long id;

    @ApiModelProperty(value = "权限名称")
    String name;

    @ApiModelProperty(value = "权限地址")
    String url;

    @ApiModelProperty(value = "权限类别")
    PrivilegeEnum type;

    @ApiModelProperty(value = "父id")
    @JsonSerialize(using = ToStringSerializer.class)
    Long parentId;

    @ApiModelProperty(value = "序号")
    Integer sequence;

    @ApiModelProperty(value = "是否启用，false：停用，true：启用")
    Boolean enable;

    @ApiModelProperty(value = "按钮")
    List<PrivilegeResult> buttons;

    @ApiModelProperty(value = "操作栏地址")
    List<PrivilegeResult> links;

    public PrivilegeResult() {

    }

    public PrivilegeResult(PrivilegeCacheDto privilegeCacheDto) {
        this.id = privilegeCacheDto.getPrivilegeId();
        this.name = privilegeCacheDto.getPrivilegeName();
        this.url = privilegeCacheDto.getUrl();
        this.type = privilegeCacheDto.getPrivilegeType();
        this.parentId = privilegeCacheDto.getParentId();
        this.sequence = privilegeCacheDto.getSequence();
        this.enable = privilegeCacheDto.getEnable();
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getUrl() {
        return url;
    }

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

    public PrivilegeEnum getType() {
        return type;
    }

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

    public Long getParentId() {
        return parentId;
    }

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

    public Integer getSequence() {
        return sequence;
    }

    public void setSequence(Integer sequence) {
        this.sequence = sequence;
    }

    public Boolean getEnable() {
        return enable;
    }

    public void setEnable(Boolean enable) {
        this.enable = enable;
    }

    public List<PrivilegeResult> getButtons() {
        return buttons;
    }

    public void setButtons(List<PrivilegeResult> buttons) {
        this.buttons = buttons;
    }

    public List<PrivilegeResult> getLinks() {
        return links;
    }

    public void setLinks(List<PrivilegeResult> links) {
        this.links = links;
    }
}
