export class EvaluationOption {
    selected: boolean;
    title: string;
    constructor(selected: boolean, title: string) {
        this.selected = selected;
        this.title = title;
    }
}

// Class used for radio button options in evalution questionnaire
export class EvaluationRadioOptions {
    options: EvaluationOption[];
    constructor(
        answer1: string,
        answer2: string,
        answer3: string,
        answer4: string,
        public answer: number
    ) {
        this.options = [
            new EvaluationOption(answer === 1, answer1),
            new EvaluationOption(answer === 2, answer2),
            new EvaluationOption(answer === 3, answer3),
            new EvaluationOption(answer === 4, answer4)
        ];
    }

    reset(): void {
        this.options.forEach((option: EvaluationOption) => {
            option.selected = false;
        });
        this.answer = 0;
    }

    click(index: number): void {
        this.reset();
        this.options[index].selected = true;
        this.answer = index + 1;
    }
}
