package com.brilliance.isc.common.glemod.vo;

import com.brilliance.isc.bo.Cbb;
import com.brilliance.isc.common.api.gle.vo.GlentryRequest;
import com.brilliance.isc.common.liaallg.vo.LiaallgVo;
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.vo.AbstractCommonVo;
import com.brilliance.isc.common.vo.BizInfoVo;
import com.brilliance.isc.common.vo.GleVo;
import com.brilliance.isc.common.vo.PtsptaVo;
import com.brilliance.mda.runtime.mda.IStream;
import com.brilliance.mda.runtime.mda.impl.StreamImpl;
import com.brilliance.mda.runtime.mda.util.Decimals;
import lombok.Data;
import lombok.NoArgsConstructor;

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

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

@Data
@NoArgsConstructor
public class GlemodVo extends AbstractCommonVo {

    public GlemodVo(GlentryRequest glentryRequest) {
        this.rec = glentryRequest.getRec();
        this.cbsMap = glentryRequest.getCbsMap();
        this.ptsList = glentryRequest.getPtsList();
        this.setfog = glentryRequest.getSetfog();
        this.setfeg = glentryRequest.getSetfeg();
        this.setglg = glentryRequest.getSetglg();
        this.liaallg = glentryRequest.getLiaallg();
    }

    //number of records
    private  int glenmb;
    //booking stream
    private IStream glesrm = new StreamImpl();
    //Booking stream to Display
    private  IStream gleshwstm = new StreamImpl();
    //总行在PTY表中的INR
    //private  String heqinr = NULLSTR;
    //借方最大金额
    private BigDecimal maxamtd = Decimals.ZERO_SCALE2;
    //借方最大�'�号
    private  String maxactd = NULLSTR;
    //�'�方最大金额
    private  BigDecimal maxamtc = Decimals.ZERO_SCALE2;
    //�'�方最大�'�号
    private  String maxactc = NULLSTR;
    //结售汇人民币�'�号
    private  String jshactd = NULLSTR;
    //结售汇外币�'�号
    private  String jshactc = NULLSTR;
    //外汇'款专户过'标识
    private  String ffaflg = NULLSTR;
    //外币'款专户
    private  String ffaacc = NULLSTR;

    private List<GleVo> gles;

    private BizInfoVo rec;

    private Map<String, Cbb> cbsMap;

    private List<PtsptaVo> ptsList;

    private SetfogVo setfog;

    private SetfegVo setfeg;

    private SetglgVo setglg;

    private List<LiaallgVo> liaallg;

    @Override
    public void reset() {
        if (maxamtd == null) {
            maxamtd = Decimals.ZERO_SCALE2;
        }
        if (maxamtc == null) {
            maxamtc = Decimals.ZERO_SCALE2;
        }
        if (gles == null) {
            gles = new ArrayList<>();
        }
    }
}
