import { Page } from "@playwright/test";
import { PartQuestionsPage } from "./PartQuestionPage";
import { step } from 'framework/localTypes/Step';
import { ITestData } from 'framework/TestData';
import { ProgressBarPercentages } from 'framework/localTypes/Enums';

export default class CapabilityQuestionsPage extends PartQuestionsPage {

    constructor(page: Page) {
        super(page);
    }

    @step("CapabilityQuestionsPage >> Select Capability Questions: ")
    async handleCapabilityQuestionsPage(testCase: Partial<ITestData>) {
        const { capabilityQuestions } = testCase;

        await this.validateProgressBar(ProgressBarPercentages.CapabilityQuestionsPage);
        // Validate the capability questions are on the page
        await this.validatePartQuestions(capabilityQuestions!);

        // Select the capability question responses
        await this.selectPartQuestionResponses(capabilityQuestions!);
        
        // Proceed to the next page
        await this.nextPage();
    }
}