import { Page } from "@playwright/test";
import { DashboardPage } from "../dashboard.page";
import { emptyInbox, haveInboxHeadingColumn } from "./inbox.snapshot";

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

    async open(): Promise<void> {
        await this.page.goto("requests/inbox");
    }

    get inboxLoc() {
        return {
            table: {
                dataInRow: (data: string) => this.genLoc(`//a[contains(text(),'${data}')] | //span[contains(text(),'${data}')]`)
            },

            filter: {
                inputByID: (id: string) => this.genLoc(`//input[@id='${id}']`),
                dropdownOption: (email:string) => this.genLoc(`//div[text()='${email}']/parent::div[@class='box-text box-text-business']`),
                noOption: this.genLoc("//div[@class='no-options']")
            }
        }
    }

    get inboxSnapshot() {
        return {
            emptyInbox: emptyInbox,
            haveInboxHeadingColumn: haveInboxHeadingColumn
        }
    }
}