package com.izouma.nineth.domain;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.Entity;
import java.math.BigDecimal;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Entity
public class RockRecord extends BaseEntity {
    private Long userId;

    private String operation;

    private BigDecimal amount;

    private BigDecimal record;

    private BigDecimal lastRecord;

    public RockRecord addRecord(Long userId, BigDecimal amount, String operation) {
        this.userId = userId;
        this.amount = amount;
        this.operation = operation;
        this.lastRecord = record;
        this.record = this.record.add(amount);
        return this;
    }
}
