package com.unis.sxzcl.widget.multi_list;

import com.chad.library.adapter.base.entity.node.BaseExpandNode;
import com.chad.library.adapter.base.entity.node.BaseNode;

import org.jetbrains.annotations.Nullable;

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

/**
 * 包名: com.unis.sxzcl.widget.multi_list
 * 类名: BaseMultiBean
 * 作用描述:
 * 创建人: mQ
 * 创建时间: 2020/12/1 11:15
 * 更新人:
 * 更新时间: 2020/12/1 11:15
 * 更新说明:
 * 版本号: 1.0
 */
public class BaseMultiBean extends BaseExpandNode {

    public String name;
    public String icon;
    public String extra;
    public String content;
    public int level;

    public List<BaseNode> mChildList;

    public BaseMultiBean(String name) {
        this.name = name;
    }

    @Nullable
    @Override
    public List<BaseNode> getChildNode() {
        return mChildList;
    }

    public void addChildNode(List<BaseNode> list) {
        if (mChildList == null)
            mChildList = new ArrayList<>();
        mChildList.addAll(list);
    }

    public void addChildNode(BaseNode node) {
        if (mChildList == null)
            mChildList = new ArrayList<>();
        mChildList.add(node);
    }

    public void setChildNode(List<BaseNode> list) {
        mChildList = list;
    }

    public void setChildNode(BaseNode node) {
        if (mChildList == null) {
            mChildList = new ArrayList<>();
        } else {
            mChildList.clear();
        }
        mChildList.add(node);
    }

    public String getName() {
        return name;
    }

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

    public String getIcon() {
        return icon;
    }

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

    public String getExtra() {
        return extra;
    }

    public BaseMultiBean setExtra(String extra) {
        this.extra = extra;
        return this;
    }

    public String getContent() {
        return content;
    }

    public BaseMultiBean setContent(String content) {
        this.content = content;
        return this;
    }

    public int getLevel() {
        return level;
    }

    public BaseMultiBean setLevel(int level) {
        this.level = level;
        return this;
    }
}
