import { expect, type Locator, type Page } from '@playwright/test';
import { BasePage } from './BasePage';
import { IAppointmentDetails } from '@business-logic/types/CustomerDetails';
import { ServiceLocation } from '@business-logic/types/Enums';
import { AddressForm } from './forms/AddressForm';
import { faker } from '@faker-js/faker';

export class ServiceLocationPage extends BasePage {
    readonly page: Page;

    readonly addressForm: AddressForm;

    // Initial selection
    readonly inShopButton: Locator;
    readonly mobileButton: Locator;
    readonly dropOffButton: Locator;
    readonly RecalWarningMessage1: Locator;
    readonly RecalWarningMessage2: Locator;
    readonly militaryWarningMessage: Locator;

    constructor(page: Page) {
        super(page);
        this.page = page;

        this.addressForm = new AddressForm(page);

        // Initial selection
        this.inShopButton = this.page.locator('[buttonlabel="In-shop"]');
        this.mobileButton = this.page.locator('[buttonlabel="Mobile"]')
        this.dropOffButton = this.page.locator('[buttonlabel="Drop-off"]');
        this.RecalWarningMessage1 = this.page.getByText(/We're not able to provide mobile service/);
        this.RecalWarningMessage2 = this.page.getByText(/advanced safety system recalibration needs to be done in our shop./);
        this.militaryWarningMessage = this.page.locator('[class*="widget-name-AlertMilitaryBaseZipWidget"]');

    }

    async validateRecalWarning(){
        await expect(this.RecalWarningMessage1).toBeVisible();
        await expect(this.RecalWarningMessage2).toBeVisible();

    }
}