package com.brilliance.isc.vo.component.trtcre;

import com.brilliance.mda.runtime.mda.util.Decimals;
import com.brilliance.isc.common.liaccv.vo.LiaccvgVo;
import com.brilliance.isc.common.vo.AbstractCommonVo;
import com.brilliance.isc.common.vo.PtsptaVo;
import com.brilliance.isc.vo.model.*;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

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

@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class TrtcreVo extends AbstractCommonVo {

    private TrtcreBizInfoVo rec;

    private Map<String, CbbVo> cbsMap;

    private List<PtsptaVo> ptsptaList;

    private List<LiaccvgVo> liaccvg;

    //Role of party to be financed
    private  String fiprol = NULLSTR;
    //Create Financing
    private  String crefinflg = NULLSTR;
    //Origial Currency
    private  String oricur = NULLSTR;
    //Origial Amount
    private BigDecimal oriamt = Decimals.ZERO_SCALE3;
    //PCT Origial Amount
    private BigDecimal pctoriamt = Decimals.ZERO_SCALE3;
    //Exchange Rate
    private  BigDecimal extrat = Decimals.ZERO_SCALE6;
    //牌价说明
    private String rattxt;
    //对方?'?号
    private  String oppacc = NULLSTR;
    //交易性?'?
    private  String trntyp = NULLSTR;
    //客户类型
    private String idType = "";
    //自贸区标识
    private String zmqflg = "";

    private TrdgrpVo trdgrp;

    private TrtpVo trtp;

    private FinmodVo finmod;

    private FinancVo financ;

    @Override
    public void reset() {
        if (rec == null) {
            rec = new TrtcreBizInfoVo();
        }
        if (cbsMap == null) {
            cbsMap = new HashMap<>();
        }
        if (ptsptaList == null) {
            ptsptaList = new ArrayList<>();
        }
        ptsptaList.forEach(p -> p.reset());
        if (liaccvg == null) {
            liaccvg = new ArrayList<>();
        }
        liaccvg.forEach(l -> l.reset());
        if (trdgrp == null) {
            trdgrp = new TrdgrpVo();
        }
        trdgrp.reset();
        if (trtp == null) {
            trtp = new TrtpVo();
        }
        trtp.reset();
        if (finmod == null) {
            finmod = new FinmodVo();
        }
        finmod.reset();
    }
}
