package com.brilliance.isc.bo.model;

import com.brilliance.mda.runtime.mda.util.Decimals;
import com.brilliance.isc.bo.*;
import com.brilliance.isc.common.json.BigDecimalSerialize;
import com.brilliance.isc.common.vo.AbstractCommonVo;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Data;

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

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

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

    private Blcgrp blcgrp;

    private Fsa oldfsa;

    private Bpd bpd;

    private List<Danlst> danlst;

    @JsonSerialize(using = BigDecimalSerialize.class)
    private BigDecimal bgdamt  = Decimals.ZERO_SCALE2;

    @JsonSerialize(using = BigDecimalSerialize.class)
    private BigDecimal totamt  = Decimals.ZERO_SCALE2;

    private String buttyp  = NULLSTR;

    @JsonSerialize(using = BigDecimalSerialize.class)
    private BigDecimal sodrat  = Decimals.ZERO_SCALE6;

    private String ratflg  = NULLSTR;

    private String cpnref  = NULLSTR;

    private boolean isenableMdf;
    private boolean isenableApl;
    private boolean isenableAme;
    private boolean isenableChk;
    private boolean isenableKjc;
    private boolean isenableCxz;
    private boolean isenableBun;
    private boolean isenableUnb;
    private boolean isenableAba;
    private boolean isenableReg;
    private boolean isenableRcv;
    private boolean isenableRfu;
    private boolean isenableUnd;
    private boolean isenableDet;
    private boolean isenableRet;

    @Override
    public void reset() {
        if (blcgrp == null) {
            blcgrp = new Blcgrp();
        }
        if (oldfsa == null) {
            oldfsa = new Fsa();
        }
        if (bpd == null) {
            bpd = new Bpd();
        }
        if (danlst == null) {
            danlst = new ArrayList<>();
        }
    }
}
