package com.unis.sxzcl.ui.work_module;


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.List;

/**
 * 创建人: mQ
 * 时间: 2021/1/7 15:05
 */
public class WorkModuleBean extends BaseExpandNode {

    // 图片
    private int img;
    // 标题
    private String name;
    // 是否是作业
    private boolean isWork;
    // 次级数组
    private List<BaseNode> childList;

    public WorkModuleBean() {
    }

    public WorkModuleBean(String name, List<BaseNode> childList) {
        this.name = name;
        this.childList = childList;
        this.isWork = false;
    }

    public WorkModuleBean(String name, int img) {
        this.name = name;
        this.img = img;
        this.isWork = true;
    }

    /**
     * 创建标题数据
     * <p>
     * 默认没有图标
     * 不是作业功能
     *
     * @param name      标题名称
     * @param childList 子集
     * @return
     */
    public WorkModuleBean createTitle(String name, List<BaseNode> childList) {
        this.name = name;
        this.childList = childList;
        this.isWork = false;
        return this;
    }

    /**
     * 创建作业数据
     * <p>
     * 默认是作业
     * 需要传图标
     *
     * @param img  图标
     * @param name 功能名称
     * @return
     */
    public WorkModuleBean createWork(String name, int img) {
        this.name = name;
        this.img = img;
        this.isWork = true;
        return this;
    }

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


    public int getImg() {
        return img;
    }

    public String getName() {
        return name;
    }

    public boolean isWork() {
        return isWork;
    }
}
