package com.ningdatech.carapi.driver.model;

import cn.hutool.core.collection.CollectionUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

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

/**
 * @author liuxinxin
 * @date 2022/10/22 上午9:34
 */

@ApiModel("培训材料总揽列表")
@Data
public class TrainingMaterialOverviewInfo {

    @Size(min = 1, max = 6)
    @ApiModelProperty("规则制度材料列表")
    private List<TrainingMaterialInfo> ruleSystemMaterialList;

    @Size(min = 1, max = 6)
    @ApiModelProperty("政策文件材料列表")
    private List<TrainingMaterialInfo> policyDocumentsMaterialInfoList;

    @Size(min = 1, max = 6)
    @ApiModelProperty("安全知识材料列表")
    private List<TrainingMaterialInfo> safetyKnowledgeMaterialInfoList;

    @Size(min = 1, max = 6)
    @ApiModelProperty("事故案例材料列表")
    private List<TrainingMaterialInfo> accidentCaseMaterialInfoList;

    @Size(min = 1, max = 6)
    @ApiModelProperty("培训视频材料列表")
    private List<TrainingMaterialInfo> trainingVideoMaterialInfoList;

    @Size(min = 1, max = 6)
    @ApiModelProperty("其他材料列表")
    private List<TrainingMaterialInfo> otherMaterialInfoList;


    public List<TrainingMaterialInfo> getAllList() {
        List<TrainingMaterialInfo> trainingMaterialInfoList = new ArrayList<>();
        if (CollectionUtil.isNotEmpty(this.ruleSystemMaterialList)) {
            trainingMaterialInfoList.addAll(this.ruleSystemMaterialList);
        }
        if (CollectionUtil.isNotEmpty(this.policyDocumentsMaterialInfoList)) {
            trainingMaterialInfoList.addAll(this.policyDocumentsMaterialInfoList);
        }
        if (CollectionUtil.isNotEmpty(this.safetyKnowledgeMaterialInfoList)) {
            trainingMaterialInfoList.addAll(this.safetyKnowledgeMaterialInfoList);
        }
        if (CollectionUtil.isNotEmpty(this.accidentCaseMaterialInfoList)) {
            trainingMaterialInfoList.addAll(this.accidentCaseMaterialInfoList);
        }
        if (CollectionUtil.isNotEmpty(this.trainingVideoMaterialInfoList)) {
            trainingMaterialInfoList.addAll(this.trainingVideoMaterialInfoList);
        }
        if (CollectionUtil.isNotEmpty(this.otherMaterialInfoList)) {
            trainingMaterialInfoList.addAll(this.otherMaterialInfoList);
        }
        return trainingMaterialInfoList;
    }

}
