import { Page } from "@playwright/test"
import { DashboardPage } from "../dashboard.page"

export class MyCompanyPage extends DashboardPage {
    constructor(page: Page) {
        super(page)
    }

    get myCompanyLoc() {
        return {
            title: this.genLoc(`//span[contains(text(),'My Company')]`),
            firstNameInput: this.genLoc(`//input[@name="first_name"]`),
            lastNameInput: this.genLoc(`//input[@name="last_name"]`),
            saveButton: this.genLoc(`//button[@type='submit' and normalize-space()='Update']`),
            userProfileAvatar: this.genLoc(`//div[@id="user-profile"]`),
            inputAvatar: this.genLoc(`//input[@type='file']`),
            inputEmail: this.genLoc(`//input[@name='email']`),
            avatarErrorMessage: this.genLoc(`//div[contains(@class, 'error-avatars')]`),
            inputPhone: this.genLoc(`//input[@name='phone_number']`),
            inputAddress: this.genLoc(`//input[@name='address_1']`),
            inputSuite: this.genLoc(`//input[@name='address_2']`),
            inputCity: this.genLoc(`//input[@name='city']`),
            customSelectState: this.genLoc(`//div[contains(@class, 'selectize selectize-control')]`),
            customInputState: this.genLoc(`//input[@name='new-password']`),
            optionState: this.genLoc(`//option`),
            inputZip: this.genLoc(`//input[@name='zip_code']`),
            msgInvalidEmail: this.genLoc("//span[text()='The email address field is not in the correct format']")
        }
    }

    async open() {
        await this.page.goto('setting/my-company')
    }
}