package com.brilliance.isc.bo.model;

import com.brilliance.mda.runtime.mda.util.Decimals;
import org.slf4j.LoggerFactory;
import org.slf4j.Logger;
import com.brilliance.isc.bo.Cbb;
import com.brilliance.isc.bo.Eba;
import com.brilliance.isc.common.json.BigDecimalSerialize;
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 com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;
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 Cfagit <T1 extends BizInfoVo, T2 extends BizAmdInfoVo> extends AbstractCommonVo{
    private static Logger log = LoggerFactory.getLogger(Cfagit.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  String visflg = NULLSTR;
    //地区机构号
    private  String ownextkey = NULLSTR;
    //变动信息数目
    private  int dclnum;
    //?'?任余额信息
    private  String dclflg = NULLSTR;
    //数据提取操作类型
    private  String cfatyp = NULLSTR;
    //数据采集标志
    private  String cfaflg = NULLSTR;
    //签约信息
    private  String basflg = NULLSTR;
    //履约信息
    private  String vrfflg = NULLSTR;
    //原保函金额
    @JsonSerialize(using = BigDecimalSerialize.class)
    private  BigDecimal oldamt = Decimals.ZERO_SCALE2;
    //履约信息数目
    private  int vrfnum;

    /**
     * 前端监控受益人是否修改，需要加参数保存受益人修改状态
     */
    private String benchange = NULLSTR;
    private String becchange = NULLSTR;

    /**
      *申报管理交易-增加信息-start
      */
    //收付汇日期
    @JsonFormat(pattern="yyyy-MM-dd",timezone="GMT+8")
    private Date paydat = NULLDATE;
    //EBLinr
    private String eblinr = NULLSTR;
    /**
     *申报管理交易-增加信息--end
     */

    private Ebagrp recgrp;

//    private Ebap recp;

    private Eblmod eblmod;

    private Cutp cutp;

    /**
      *
      */
    private Cfamap cfamap;

    /**
     *对外担保－签约信息
     */
    private Eba oldeba;

    /**
      *申报号码模块
      */
    private Cfaref cfaref;

    @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(eblmod == null) {
            eblmod = new Eblmod();
            eblmod.reset();
        }
        if(cfamap == null) {
            cfamap = new Cfamap();
            cfamap.reset();
        }
        if(oldeba == null) {
            oldeba = new Eba();
        }
        if(recgrp == null){
            recgrp = new Ebagrp();
            recgrp.reset();
        }
        if(cfaref == null) {
            cfaref = new Cfaref();
            cfaref.reset();
        }
    }

}

