package com.zd.exam.domain;

import com.zd.common.core.annotation.Excel;
import com.zd.common.core.valid.ValidGroup;
import com.zd.common.core.web.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.collections4.CollectionUtils;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import java.util.ArrayList;
import java.util.List;

/**
 * 学习分类对象 el_category
 *
 * @author liubo
 * @date 2021-12-07
 */
@ApiModel("学习分类")
public class ElCategory extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * ID
     */
    @ApiModelProperty(value = "${comment}")
    private Long id;
    /**
     * 课程分类标题
     */
    @Excel(name = "课程分类标题")
    @NotBlank(groups = ValidGroup.Crud.Create.class, message = "课程分类标题不能为空")
    @Length(message = "课程分类标题长度不能超过256")
    @ApiModelProperty(value = "课程分类标题")
    private String title;
    /**
     * 父级ID 默认0
     */
    @Excel(name = "父级ID 默认0")
    @ApiModelProperty(value = "父级ID 默认0")
    private Long parentId;
    /**
     * 等级 默认1
     */
    @Excel(name = "等级 默认1")
    @ApiModelProperty(value = "等级 默认1")
    private Integer level;
    /**
     * 分类类型 保留区分学习和课件
     */
    @Excel(name = "分类类型 保留区分学习和课件")
    @ApiModelProperty(value = "1 资源，2 课程")
    private Integer type;

    //private boolean hasChildren = false;

    /**
     * 子目录
     */
    private List<ElCategory> children = new ArrayList<ElCategory>();

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

    public Long getId() {
        return id;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getTitle() {
        return title;
    }

    public Long getParentId() {
        return parentId;
    }

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

    public void setLevel(Integer level) {
        this.level = level;
    }

    public Integer getLevel() {
        return level;
    }

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

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

    public Integer getType() {
        return type;
    }

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