import { BaseComponent } from '@/shared/base/BaseComponent';
import { Locator } from '@playwright/test';

export class SegmentPicker extends BaseComponent {
  private readonly body = this.host.getByTestId('segment-picker');

  select(item: string): Promise<void> {
    return this.getItem(item).click();
  }

  private getItem(item: string): Locator {
    return this.body.locator(`[data-test-id=segment-item]:text-is("${item}")`);
  }
}
