package de.szut.casino.lootboxes;

import com.fasterxml.jackson.annotation.JsonBackReference;
import jakarta.persistence.*;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

@Getter
@Setter
@Entity
@NoArgsConstructor
public class RewardEntity {

    public RewardEntity(BigDecimal value, BigDecimal probability) {
        this.value = value;
        this.probability = probability;
    }

    @Id
    @GeneratedValue
    private Long id;

    @Column(precision = 19, scale = 2)
    private BigDecimal value;

    @Column(precision = 5, scale = 2)
    private BigDecimal probability;

    @ManyToMany(mappedBy = "rewards")
    @JsonBackReference
    private List<LootBoxEntity> lootBoxes = new ArrayList<>();
}
