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

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

  async goto(id: string) {
    await this.page.goto(`/product/product/${id}`);
  }

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

  get statusBadge() {
    return this.page.getByText(/^(draft|active|archived|inactive)$/i).first();
  }

  get editButton() {
    return this.page.getByRole("button", { name: "Edit Product", exact: true });
  }

  get activateButton() {
    return this.page.getByRole("button", { name: "Activate Product", exact: true });
  }

  get deactivateButton() {
    return this.page.getByRole("button", { name: "Deactivate Product", exact: true });
  }

  get reactivateButton() {
    return this.page.getByRole("button", { name: "Reactivate Product", exact: true });
  }

  get deleteButton() {
    return this.page.getByRole("button", { name: "Delete Product", exact: true });
  }

  get generateVariantsButton() {
    return this.page.getByRole("button", { name: "Generate Variants", exact: true });
  }

  get manageCategoriesButton() {
    return this.page.getByRole("button", { name: "Manage Categories", exact: true });
  }

  get manageAttributesButton() {
    return this.page.getByRole("button", { name: "Manage Attributes", exact: true });
  }
}
