package ru.kayashov.bar.model.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.util.List;

@Entity
@Table(name = "tag")
@Getter
@Setter
@NoArgsConstructor
public class TagEntity {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    private String name;
    @Column(name = "en_name")
    private String enName;

    @ManyToMany()
    @JoinTable(
            name = "cocktail_tags",
            inverseJoinColumns = @JoinColumn(name = "cocktail_id"),
            joinColumns = @JoinColumn(name = "tag_id")
    )
    private List<CocktailEntity> cocktails;
}
