package beilv.vipCardAmountLog.domain;

import beilv.common.annotation.Excel;
import beilv.common.core.domain.BaseEntity;
import beilv.common.utils.DateUtils;
import beilv.common.utils.uuid.IdUtils;
import lombok.*;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.math.BigDecimal;
import java.math.RoundingMode;

/**
 * 会员卡金额流水对象 beilv_vip_card_amount_log
 *
 * @author LG
 * @date 2025-11-18
 */
@Setter
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class VipCardAmountLog extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * 流水编号
     */
    private String id;

    /**
     * 用户id
     */
    private String userId;

    /**
     * 用户名
     */
    @Excel(name = "用户名")
    private String userName;

    /**
     * 会员卡号
     */
    @Excel(name = "会员卡号")
    private String vipCardId;

    /**
     * 订单编号
     */
    @Excel(name = "订单编号")
    private String orderId;

    /**
     * 当前金额
     */
    @Excel(name = "当前金额")
    private BigDecimal currentAmount;

    /**
     * 操作金额
     */
    @Excel(name = "操作金额")
    private BigDecimal operationAmount;

    /**
     * 剩余金额
     */
    @Excel(name = "剩余金额")
    private BigDecimal remainingAmount;

    private String amountType;

    public VipCardAmountLog(String userId, String vipCardId, String orderId, BigDecimal currentAmount, BigDecimal operationAmount, String amountType) {
        this.id = IdUtils.fastSimpleUUID();
        this.userId = userId;
        this.vipCardId = vipCardId;
        this.orderId = orderId;
        this.currentAmount = currentAmount;
        this.operationAmount = operationAmount;
        this.setCreateTime(DateUtils.getNowDate());
        this.remainingAmount = currentAmount.add(operationAmount).setScale(2, RoundingMode.HALF_UP);
        this.amountType = amountType;
    }
}
