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

export class ServiceZipPage extends LookupPage {

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

    @step("ZipLookupPage >> Lookup by service ZIP: ")
    async handleServiceZipPage(testData: Partial<ITestData>) {
        const { customerDetails, vehicleDetails, alertFlags } = testData;
        await this.validateProgressBar(ProgressBarPercentages.ServiceZipPage);
        await this.enterZip(customerDetails!.address.postalCode!);
        await this.handleZipValidation(testData, customerDetails!.address.postalCode!, vehicleDetails!.vehicleLookupType!, alertFlags!);
    }
}