package com.brilliance.isc.vo.lg;

import com.brilliance.mda.runtime.mda.IStream;
import com.brilliance.mda.runtime.mda.impl.StreamImpl;
import com.brilliance.mda.runtime.mda.util.Decimals;
import com.brilliance.isc.common.json.BigDecimalSerialize;
import com.brilliance.isc.common.transaction.vo.BaseTransactionVo;
import com.brilliance.isc.common.trnmod.vo.SwiaddVo;
import com.brilliance.isc.vo.model.Gidgrp;
import com.brilliance.isc.vo.model.Gitp;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
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
@JsonIgnoreProperties(ignoreUnknown = true)
public class GitdlaStoreVo extends BaseTransactionVo {
    private Gidgrp gidgrp;
    private Gitp gitp;
    private Gidgrp oldgidgrp;
    private SwiaddVo swiadd;
    private String amenbr = NULLSTR;
    private String ameflg = NULLSTR;
    private String amecur = NULLSTR;
    private String addamecur = NULLSTR;

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

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

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

    private IStream decstm = new StreamImpl();

    @Override
    public void reset() {
        super.reset();
        if (gidgrp == null) {
            gidgrp = new Gidgrp();
        }
        if (oldgidgrp == null) {
            oldgidgrp = new Gidgrp();
        }
        if (swiadd == null) {
            swiadd = new SwiaddVo();
        }
    }
}
