package ru.kayashov.bar.model.entity;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import java.util.List;

@Entity
@Table(name = "ingredient")
@Getter
@Setter
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class IngredientEntity {
    @Id
    private Long id;
    private String name;
    private String enName;
    private Boolean alcohol;
    private Integer abv;

    @Column(columnDefinition = "text")
    private String description;

    @OneToMany(mappedBy = "ingredient")
    private List<ReceiptEntity> receipts;

    @ManyToOne
    @JoinColumn(name = "type")
    private TypeEntity type;

    @OneToMany(mappedBy = "ingredient")
    private List<BarIngredientStorage> barIngredients;
}
