package com.hzs.sale.order.dto;

import com.hzs.common.core.constant.msg.ConfigMsgConstants;
import com.hzs.common.util.TransactionUtils;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;

/**
 * @Description: 订单查询扣费数据
 * @Author: jiang chao
 * @Time: 2023/2/1 17:55
 * @Classname: OrderQueryChargeDTO
 * @PackageName: com.hzs.sale.order.dto
 */
@NoArgsConstructor
@AllArgsConstructor
@Builder
@Data
public class OrderQueryChargeDTO {

    /**
     * 币种
     */
    private Integer pkAccount;
    /**
     * 币种翻译KEY
     */
    private Integer accountKey;

    /**
     * 费用
     */
    private BigDecimal cost;

    /**
     * 校验余额不足信息
     *
     * @return
     */
    public String getMsg() {
        if (null != cost && cost.compareTo(BigDecimal.ZERO) > 0
                && null != pkAccount && pkAccount == 0) {
            // 费用为0 并且 币费不为空
            return TransactionUtils.getContent(ConfigMsgConstants.MEMBER_BALANCE_INSUFFICIENT);
        }
        return "";
    }

}
