package com.izouma.nineth.domain;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import java.math.BigDecimal;
import java.time.LocalDateTime;

@Data
@Entity
@AllArgsConstructor
@NoArgsConstructor
@Builder
@DynamicUpdate
public class UserBalance extends BaseEntityNoID {

    @Id
    private Long userId;

    private BigDecimal balance;

    private BigDecimal lastBalance;

    private boolean locked = false;

    private String lockReason;

    private LocalDateTime lockTime;

    public UserBalance(Long userId) {
        this.userId = userId;
        this.balance = BigDecimal.ZERO;
        this.lastBalance = BigDecimal.ZERO;
    }
}
