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

import com.brilliance.isc.bo.Cbb;
import com.brilliance.isc.bo.Spt;
import com.brilliance.isc.common.setfeg.vo.SetfegVo;
import com.brilliance.isc.common.setfog.vo.SetfogVo;
import com.brilliance.isc.common.setglg.vo.SetglgVo;
import com.brilliance.isc.common.trndoc.vo.DoceotVo;
import com.brilliance.isc.common.trndoc.vo.TrndocVo;
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.JsonIgnoreProperties;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

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

@Data
@ApiModel(value = "面函请求信息", description = "面函请求信息")
@JsonIgnoreProperties(ignoreUnknown = true)
public class TrndocRequest<T1 extends BizInfoVo, T2 extends BizAmdInfoVo> extends AbstractCommonVo {

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

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

    @ApiModelProperty(value = "经办数据Spt主键", name = "sptinr", required = true)
    private String sptinr = 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;

    @ApiModelProperty(value = "面函列表", name = "doceot", required = true)
    private List<DoceotVo> doceot;

    @ApiModelProperty(value = "账务信息", name = "setglg", required = true)
    private SetglgVo setglg;

    @ApiModelProperty(value = "费用信息", name = "setfeg", required = true)
    private SetfegVo setfeg;

    @ApiModelProperty(value = "国外信息", name = "setfog", required = true)
    private SetfogVo setfog;

    private Spt spt;

    @ApiModelProperty(hidden = true)
    private TrndocVo trndocVo;

    //收支申报类型
    private String boptyp = NULLSTR;

    @Override
    public void reset() {
        if (rec == null) {
            rec = (T1) new BizInfoVo();
        }
        rec.reset();
        if (amdRec == null) {
            amdRec = (T2) new BizAmdInfoVo();
        }
        amdRec.reset();
        if (ptsList == null) {
            ptsList = new ArrayList<>();
        }
        ptsList.forEach(p -> p.reset());
        if (doceot == null) {
            doceot = new ArrayList<>();
        }
        doceot.forEach(doceotVo -> doceotVo.reset());
        if (spt == null) {
            spt = new Spt();
        }
        if (trndocVo == null) {
            trndocVo = new TrndocVo(this);
        }
        trndocVo.reset();
    }
}
