package com.brilliance.isc.common.setfeg.fee;

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.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

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

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

@Data
public class Wrksum {

    private BigDecimal accamt = Decimals.ZERO_SCALE2;
    //acc. currency
    private String acccur = NULLSTR;
    //value date
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date valdat;
    //account
    private String act = NULLSTR;
    //currency
    private String cur = NULLSTR;
    //amount
    private BigDecimal amt = Decimals.ZERO_SCALE2;
    //2.nd Amount
    private BigDecimal amt2 = Decimals.ZERO_SCALE2;
    //disposition
    private String dsp = NULLSTR;
    //Type
    private String flg = NULLSTR;
    //role
    private String rol = NULLSTR;
    //disposition flag F-not modifiable
    private String dspflg = NULLSTR;
    //Forward contract to be used for conversion
    private String fcdinr = NULLSTR;
    //value date as set from transaction
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date valdattrn;
    //Type of amount setteled
    private String docamttyp = NULLSTR;
    //Document Cur to Base EXTernal RATe
    private BigDecimal dcbextrat = Decimals.ZERO_SCALE6;
    //Settle Cur to Base EXTernal RATe
    private BigDecimal scbextrat = Decimals.ZERO_SCALE6;
    //Ids totalled up for amount
    private IStream amtidsstm = new StreamImpl();
    //Group of amounts
    private String gllgrp = NULLSTR;
    //置灰字段
    private Set<String> disableSet;

    public void setDisable(String field) {
        if (disableSet == null) {
            disableSet = new HashSet<>();
        }
        disableSet.add(field);
    }

    public void resetDisable(String field) {
        if (disableSet == null) {
            disableSet = new HashSet<>();
        }
        disableSet.remove(field);
    }
}
