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

import com.brilliance.mda.runtime.mda.util.Decimals;
import com.brilliance.mda.support.jakson.serialize.BigDecimalSerializeRate;
import com.brilliance.mda.support.jakson.serialize.DecimalLength;
import com.brilliance.isc.bo.Fcd;
import com.brilliance.isc.common.liaone.vo.AcpliaVo;
import com.brilliance.isc.common.vo.AbstractCommonVo;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;

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

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

    //account
    private  String acc = NULLSTR;
    @ApiModelProperty(value = "Fcd对象Inr", name = "fcdinr", required = true)
    private String fcdinr;
    @ApiModelProperty(value = "Fcd对象Inr", name = "oldfcdinr", required = true)
    private String oldfcdinr;
    @ApiModelProperty(value = "Contract currency", name = "concur", required = true)
    private  String concur = NULLSTR;
    @ApiModelProperty(value = "Currency", name = "cur", required = true)
    private  String cur = NULLSTR;
    @ApiModelProperty(value = "Business sector for showing it in grid and account defaulting in LIAONE", name = "bussec", required = true)
    private  String bussec = NULLSTR;
    @ApiModelProperty(value = "Rate", name = "rat", required = true)
    @JsonSerialize(using = BigDecimalSerializeRate.class)
    @DecimalLength(6)
    private BigDecimal rat = Decimals.ZERO_SCALE6;
    @ApiModelProperty(value = "Old Amount", name = "oldamt", required = true)
    private BigDecimal oldamt = Decimals.ZERO_SCALE2;
    @ApiModelProperty(value = "Amount", name = "amt", required = true)
    private BigDecimal amt = Decimals.ZERO_SCALE2;
    @ApiModelProperty(value = "Covered Amount", name = "covamt", required = true)
    private BigDecimal covamt = Decimals.ZERO_SCALE2;
    @ApiModelProperty(value = "Actual Covered Amount", name = "acccovamt", required = true)
    private BigDecimal acccovamt = Decimals.ZERO_SCALE2;
    //Ref. of cash collection
    private String ownref = NULLSTR;
    //Available amount for coverage of underlying forward contract
    private BigDecimal fcdavbamt = Decimals.ZERO_SCALE2;
    //Currency of forward contract
    private String fcdacccur = NULLSTR;
    //Covered Amount in currency of forward contract if no forward contract: covered amount
    private BigDecimal fcdaccamt = Decimals.ZERO_SCALE2;
    //Role
    private String role;
    @JsonIgnore
    private AcpliaVo acplia = null;
    //Id of coverage default CUR
    private String ccvid = NULLSTR;
    //Flag, set if line is read from old entry
    private String oldflg = NULLSTR;
    //grid id
    private String bflg = NULLSTR;
    //grid id
    private int bid = -1;
    //定期保证金调整标志
    private String ccdflg = NULLSTR;
    //保证金台调整标志按钮l
    private String ccdflgbut = "N";
    //保证金调整的时候新增记录标识
    private String newFlag = "N";
    @Override
    public void reset() {
        if (rat == null) {
            rat = Decimals.ZERO_SCALE6;
        }
        if (oldamt == null) {
            oldamt = Decimals.ZERO_SCALE2;
        }
        if (amt == null) {
            amt = Decimals.ZERO_SCALE2;
        }
        if (covamt == null) {
            covamt = Decimals.ZERO_SCALE2;
        }
        if (acccovamt == null) {
            acccovamt = Decimals.ZERO_SCALE2;
        }
        if (acplia == null) {
            acplia = new AcpliaVo();
        }
        acplia.reset();
    }
}
