package studycave.studycaverestservice.model.studyGroupMember;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import studycave.studycaverestservice.model.studyGroup.StudyGroup;
import studycave.studycaverestservice.model.user.User;

import javax.persistence.*;

@Entity
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
public class StudyGroupMember {

    @Id
    @Column(name="id")
    @GeneratedValue(strategy= GenerationType.IDENTITY)
    private Long id;

    @ManyToOne
    @JoinColumn(name="group_id",referencedColumnName="id")
    private StudyGroup group;

    @ManyToOne
    @JoinColumn(name="user_id",referencedColumnName="id")
    private User user;

    @Column(name="is_group_leader")
    private Boolean isGroupLeader;

    public StudyGroupMember(StudyGroup group, User user, Boolean isGroupLeader) {
        this.group = group;
        this.user = user;
        this.isGroupLeader = isGroupLeader;
    }
}
