package studycave.studycaverestservice.model.test.question;

import com.fasterxml.jackson.annotation.JsonManagedReference;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

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

@Entity
@AllArgsConstructor
public class QuestionChoices extends Question {

    @OneToMany(fetch = FetchType.LAZY, mappedBy="question", cascade = CascadeType.ALL)
    @JsonManagedReference
    List<AnswerChoices> answers = new ArrayList<>();

    @Transient
    @Getter
    @Setter
    List<AnswerChoices> answers_help = new ArrayList<>();

    public List<AnswerChoices> getAnswers() {
        return answers;
    }

    public void setAnswers(List<AnswerChoices> answers) {
        this.answers = answers;
    }

    public void setType() {
        this.type = "choices";
    }

    public QuestionChoices(){
        super();
    }
}
