package com.brilliance.isc.common.api.trtcre.vo;

import com.brilliance.isc.common.liaccv.vo.LiaccvgVo;
import com.brilliance.isc.common.vo.AbstractCommonVo;
import com.brilliance.isc.common.vo.BizInfoVo;
import com.brilliance.isc.common.vo.PtsptaVo;
import com.brilliance.isc.vo.component.dftcre.DftcreVo;
import com.brilliance.isc.vo.component.trtcre.TrtcreVo;
import com.brilliance.isc.vo.model.CbbVo;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;

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 TrtcreRequest<T extends BizInfoVo> extends AbstractCommonVo {

    /**
     * 当前交易码
     */
    private String transName = NULLSTR;

    /**
     * 当前经办人员ID
     */
    private String userId = NULLSTR;

    /**
     * 业务摘要信息
     */
    private T rec;
    /**
     * CBB列表
     */
    private Map<String, CbbVo> cbsMap;
    /**
     * 交易角色参与方列表
     */
    private List<PtsptaVo> ptsList;

    private List<LiaccvgVo> liaccvg;

    private TrtcreVo trtcre;

    @Override
    public void reset() {
        if (rec == null) {
            rec = (T) new BizInfoVo();
        }
        rec.reset();
        if (cbsMap == null) {
            cbsMap = new HashMap<>();
        }
        if (ptsList == null) {
            ptsList = new ArrayList<>();
        }
        ptsList.forEach(p -> p.reset());
        if (trtcre == null) {
            trtcre = new TrtcreVo();
        }
        trtcre.reset();
    }
}
