package com.brilliance.isc.bo.model;

import org.slf4j.LoggerFactory;
import org.slf4j.Logger;
import com.brilliance.isc.bo.Cbb;
import com.brilliance.isc.bo.Cda;
import com.brilliance.isc.bo.Eca;
import com.brilliance.isc.common.vo.AbstractCommonVo;
import com.brilliance.isc.common.vo.BizAmdInfoVo;
import com.brilliance.isc.common.vo.BizInfoVo;
import com.brilliance.isc.common.vo.PtsptaVo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.*;

import static com.brilliance.mda.runtime.mda.Constants.NULLDATE;
import static com.brilliance.mda.runtime.mda.Constants.NULLSTR;

/**
 *资本外债 公共模型
 */

@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class Cfabop<T1 extends BizInfoVo, T2 extends BizAmdInfoVo> extends AbstractCommonVo{
    private static Logger log = LoggerFactory.getLogger(Cfabop.class);

    @ApiModelProperty(value = "当前交易码", name = "transName", required = true)
    private String transName = NULLSTR;

    @ApiModelProperty(value = "当前经办人员ID", name = "userId", required = true)
    private String userId = NULLSTR;

    @ApiModelProperty(value = "业务摘要信息", name = "rec", required = true)
    private T1 rec;

    @ApiModelProperty(value = "业务摘要修改信息", name = "rec", required = true)
    private T2 amdRec;

    @ApiModelProperty(value = "CBB列表", name = "cbsMap", required = true)
    private Map<String, Cbb> cbsMap;

    @ApiModelProperty(value = "交易角色参与方列表", name = "ptsList", required = true)
    private List<PtsptaVo> ptsList;


    /**
     * 国内外汇贷款
     */
    private Cfaeca cfaeca;

    /**
     * 海外代付
     */
    private Cfaead cfaead;


    /**
     * 远期信用证
     */
    private Cfaeaf cfaeaf;



    @Override
    public void reset() {
        if (rec == null) {
            rec = (T1) new BizInfoVo();
        }
        rec.reset();
        if (amdRec == null) {
            amdRec = (T2) new BizAmdInfoVo();
        }
        amdRec.reset();
        if (cbsMap == null) {
            cbsMap = new HashMap<>();
        }
        if (ptsList == null) {
            ptsList = new ArrayList<>();
        }
        
        ptsList.forEach(p -> p.reset());

        if(cfaeca == null) {
            cfaeca = new Cfaeca();
        }
        cfaeca.reset();

        if(cfaead == null) {
            cfaead = new Cfaead();
        }
        cfaead.reset();

        if(cfaeaf == null) {
            cfaeaf = new Cfaeaf();
        }
        cfaeaf.reset();

    }

}

