package com.zt.plat.module.qms.business.bus.liteflow.slot;

import java.time.LocalDateTime;
import java.util.List;

import cn.hutool.core.collection.CollUtil;
import com.zt.plat.framework.security.core.LoginUser;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayTaskDO;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayTaskDataDO;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessAssayTaskDetailDO;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessSubSampleDO;
import com.zt.plat.module.qms.business.bus.liteflow.param.AssignAssayUser;
import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigAssayMethodDO;
import lombok.Data;
import lombok.experimental.Accessors;

@Data
@Accessors(chain = true)
public class SampleTaskAssignContext {
    
    /** 租户id **/
    private Long tenantId;
    
    /** 当前时间 **/
    private LocalDateTime currentDateTime = LocalDateTime.now();

    /** 当前登录用户 **/
    private LoginUser loginUser;
    
    /** 当前登录人 **/
    private String loginRealname;
    
    /** 指派类型 **/
    private SampleTaskAssignTypeEnum SampleTaskAssignType;
	
	/** 分析方法id **/
	private Long assignConfigAssayMethodId;
	
	/** 接受分配任务的人员 **/
	private List<AssignAssayUser> assignAssayUserList;
	
	/** 分析人员 **/
	private AssignAssayUser assignAssayUser;
	
	/** 待分析的样品id **/
	private List<Long> assignSampleIdList;
    
    /** 分析方法配置 **/
    private List<ConfigAssayMethodDO> configAssayMethodList;
    
    /** 检测任务id列表 **/
    private List<Long> assayTaskDataIdList;
    
    public ConfigAssayMethodDO getConfigAssayMethodById(Long id) {
    	ConfigAssayMethodDO configAssayMethod = null;
    	if (CollUtil.isNotEmpty(this.configAssayMethodList)) {
			configAssayMethod = this.configAssayMethodList.stream().filter(f -> f.getId().equals(id)).findFirst().orElse(null);
		}
    	return configAssayMethod;
    }
    
    private List<BusinessSubSampleDO> businessSubSampleList;
    
    public BusinessSubSampleDO getBusinessSubSampleById(Long id) {
    	BusinessSubSampleDO businessSubSample = null;
    	if (CollUtil.isNotEmpty(this.businessSubSampleList)) {
			businessSubSample = this.businessSubSampleList.stream().filter(f -> f.getId().equals(id)).findFirst().orElse(null);
		}
    	
    	return businessSubSample;
	}
    
    /** 子样检测任务 **/
    private List<BusinessAssayTaskDataDO> businessAssayTaskDataList;
    
    /** 保存任务指派单列表 **/
    private List<BusinessAssayTaskDO> saveBusinessAssayTaskList;
    
    /** 更新任务指派单列表 **/
    private List<BusinessAssayTaskDO> updateBusinessAssayTaskList;
    
    /** 任务指派的明细列表 **/
    private List<BusinessAssayTaskDetailDO> businessAssayTaskDetailList;

}
