package com.xisc.pm.api.dto;

import java.io.Serializable;
import java.util.List;

import org.apache.commons.lang3.StringUtils;

import io.choerodon.core.exception.CommonException;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * 
 * @author 曾俊 jun.zeng@hand-china.com 2024-07-29 15:50:20
 *
 */
@Data
@ApiModel("生产合同轴合同与非轴合同选择接口参数DTO")
public class PmProContSelectionRequestDTO implements Serializable {
    
    private static final long serialVersionUID = 5486994876024799773L;

    @ApiModelProperty("租户ID")
    private Long tenantId ;
    
    @ApiModelProperty("合同抽取条件")
    private PmProContFilterRequestDTO pmContFilterRequest ;
    
    @ApiModelProperty("轴合同编码")
    private String axisOrderNo ;
    
    @ApiModelProperty("所有合同列表")
    private List<PmProContSelectionDTO> contSelectionList ;
    
    @ApiModelProperty("本次勾选的数据")
    private String currentOrderNo ;
    
    public void check() {
        if (this.getContSelectionList() == null || this.getContSelectionList().isEmpty()) {
            throw new CommonException("pm.pm_pro_cont_013");
        }
        if (StringUtils.isBlank(this.getAxisOrderNo())) {
            throw new CommonException("pm.pm_pro_cont_009", "AxisOrderNo");
        }
        if (StringUtils.isBlank(this.getCurrentOrderNo())) {
            throw new CommonException("pm.pm_pro_cont_009", "CurrentOrderNo");
        }
        this.getPmContFilterRequest().check();
    }
    
}
