package com.hfkj.model;

import com.alibaba.fastjson.JSONObject;

import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName: CmsCategoryTreeModel
 * @Description: 内容管理 内容分类树
 * @author: gongjia
 * @date: 2019/10/28 9:58
 * @Copyright: 2019 www.shinwoten.com Inc. All rights reserved.
 */
public class CmsCategoryTreeModel {

    private Long id;
    private String code;
    private Long parentId;
    private Integer type;    // 类型:
    private String remark;
    private String coverImg;
    private JSONObject unitInfo; // 单位信息
    private String ext1;
    private String ext2;
    private String ext3;

    private String text;
    private TreeStateModel state;
    private List<CmsCategoryTreeModel> nodes;

    public Long getId() {
        return id;
    }

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

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public Long getParentId() {
        return parentId;
    }

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

    public Integer getType() {
        return type;
    }

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

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    public TreeStateModel getState() {
        return state;
    }

    public void setState(TreeStateModel state) {
        this.state = state;
    }

    public List<CmsCategoryTreeModel> getNodes() {
        return nodes;
    }

    public void setNodes(List<CmsCategoryTreeModel> nodes) {
        this.nodes = nodes;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getExt1() {
        return ext1;
    }

    public void setExt1(String ext1) {
        this.ext1 = ext1;
    }

    public String getExt2() {
        return ext2;
    }

    public void setExt2(String ext2) {
        this.ext2 = ext2;
    }

    public String getExt3() {
        return ext3;
    }

    public void setExt3(String ext3) {
        this.ext3 = ext3;
    }

    public String getCoverImg() {
        return coverImg;
    }

    public void setCoverImg(String coverImg) {
        this.coverImg = coverImg;
    }

    public JSONObject getUnitInfo() {
        return unitInfo;
    }

    public void setUnitInfo(JSONObject unitInfo) {
        this.unitInfo = unitInfo;
    }

    /**
     *  增加子节点
     * @param: [child]
     *
     */
    public void addChild(CmsCategoryTreeModel child) {
        if (this.nodes == null) {
            this.nodes = new ArrayList<>();
        }
        this.nodes.add(child);
    }

    /**
     *  增加子节点
     * @param: [childList]
     *
     */
    public void addChildList(List<CmsCategoryTreeModel> childList) {
        if (this.nodes == null) {
            this.nodes = new ArrayList<>();
        }
        this.nodes.addAll(childList);
    }

}
