package cn.ezhizao.framework.web.domain;

import cn.ezhizao.project.system.domain.SysDept;
import cn.ezhizao.project.system.domain.SysMenu;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.models.auth.In;

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

/**
 * Treeselect树结构实体类
 *
 * @author ruoyi
 */
public class TreeSelect implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 节点ID
     */
    private Long id;

    /**
     * 节点名称
     */
    private String label;

    private String deptType;

    private String deptCode;

    private String status;

    private Long parentId;
    private String isWorkSection;
    private Integer isCentralizedTurnover;
    private Integer isSortPackaging;
    private String deptKey;
    /**
     * 子节点
     */
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private List<TreeSelect> children;

    public TreeSelect() {

    }

    public TreeSelect(SysDept dept) {
        this.id = dept.getDeptId();
        this.label = dept.getDeptName();
        this.deptType = dept.getType();
        this.deptCode = dept.getDeptCode();
        this.deptKey = dept.getDeptKey();
        this.status = dept.getStatus();
        this.parentId = dept.getParentId();
        this.isWorkSection = dept.getIsWorkSection();
        this.isCentralizedTurnover = dept.getIsCentralizedTurnover();
        this.isSortPackaging = dept.getIsSortPackaging();
        this.children = dept.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
    }


    public TreeSelect(SysMenu menu) {
        this.id = menu.getMenuId();
        this.label = menu.getMenuName();
        this.parentId = menu.getParentId();
        this.children = menu.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
    }

    public Integer getIsCentralizedTurnover() {
        return isCentralizedTurnover;
    }

    public void setIsCentralizedTurnover(Integer isCentralizedTurnover) {
        this.isCentralizedTurnover = isCentralizedTurnover;
    }

    public String getIsWorkSection() {
        return isWorkSection;
    }

    public void setIsWorkSection(String isWorkSection) {
        this.isWorkSection = isWorkSection;
    }

    public Long getId() {
        return id;
    }

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

    public Integer getIsSortPackaging() {
        return isSortPackaging;
    }

    public void setIsSortPackaging(Integer isSortPackaging) {
        this.isSortPackaging = isSortPackaging;
    }

    public Long getParentId() {
        return parentId;
    }

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

    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    public String getDeptType() {
        return deptType;
    }

    public void setDeptType(String deptType) {
        this.deptType = deptType;
    }

    public String getDeptCode() {
        return deptCode;
    }

    public void setDeptCode(String deptCode) {
        this.deptCode = deptCode;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

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

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

    public String getDeptKey() {
        return deptKey;
    }

    public void setDeptKey(String deptKey) {
        this.deptKey = deptKey;
    }
}
