package studycave.studycaverestservice.model.badge;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import studycave.studycaverestservice.model.userBadge.UserBadge;

import javax.persistence.*;
import java.util.ArrayList;
import java.util.List;

@Entity
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
public class Badge {
    @Id
    @Column(name="id")
    @GeneratedValue(strategy= GenerationType.IDENTITY)
    private Long id;

    private String name;

    private String iconPath;

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "badge", cascade = CascadeType.ALL)
    List<UserBadge> users = new ArrayList<>();
}
