package cn.reghao.tnb.user.app.model.po;

import cn.reghao.jutil.jdk.web.db.BaseObject;
import cn.reghao.tnb.common.auth.UserContext;
import cn.reghao.tnb.user.api.dto.ChargeReq;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

import jakarta.validation.constraints.NotNull;

/**
 * @author reghao
 * @date 2024-07-06 11:25:29
 */
@AllArgsConstructor
@NoArgsConstructor
@Getter
public class WalletCharge extends BaseObject<Integer> {
    @NotNull
    private Long chargeId;
    @NotNull
    private Double quantity;
    @NotNull
    private Long owner;
    @NotNull
    private Integer status;

    public WalletCharge(long chargeId, ChargeReq chargeReq) {
        this.chargeId = chargeId;
        this.quantity = chargeReq.getQuantity();
        this.owner = UserContext.getUserId();
        this.status = 1;
    }
}
