import type { Page, Locator } from '@playwright/test';

export class AdminLoginPage {
  readonly page: Page;
  readonly passwordInput: Locator;
  readonly submitButton: Locator;
  readonly errorMessage: Locator;

  constructor(page: Page) {
    this.page = page;
    this.passwordInput = page.getByTestId('admin-password-input');
    this.submitButton = page.getByTestId('admin-login-submit');
    this.errorMessage = page.getByTestId('admin-login-error');
  }

  async goto() {
    await this.page.goto('/admin/login');
  }

  async login(password: string) {
    await this.passwordInput.fill(password);
    await this.submitButton.click();
  }
}
