package com.brilliance.isc.bo.lc;

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

import java.math.BigDecimal;
import java.util.Date;

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

@Data
public class LitameInfo extends AbstractCommonVo {

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

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

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

    private String amecur = NULLSTR;

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

    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date amedat;

    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date newexpdat;

    private String purpos = NULLSTR;

    private String reqcan = NULLSTR;

    private int amenbr;

    private String trnchato = NULLSTR;

    private String trnfeetxt = NULLSTR;

    private String amemsgdonflg = NULLSTR;

    private String narrativeStructuredText = NULLSTR;

    @Override
    public void reset() {
        if (engamt == null) {
            engamt = Decimals.ZERO_SCALE2;
        }
        if (maxamt == null) {
            maxamt = Decimals.ZERO_SCALE2;
        }
        if (ameamt == null) {
            ameamt = Decimals.ZERO_SCALE2;
        }
        if (newamt == null) {
            newamt = Decimals.ZERO_SCALE2;
        }
    }
}
