import type { Page } from "@playwright/test";

export class AuditEntryListPage {
  private page: Page;
  constructor(page: Page) {
    this.page = page;
  }

  async goto() {
    await this.page.goto("/audit");
  }

  get heading() {
    return this.page.getByRole("heading", { name: /audit/i });
  }

  get table() {
    return this.page.getByRole("table");
  }

  getRow(entityId: string) {
    return this.page.getByRole("row").filter({ hasText: entityId });
  }

  getViewLink(entityId: string) {
    return this.getRow(entityId).getByRole("link", { name: /view/i });
  }
}
