import { Page } from '@playwright/test';

export type Selector =
  | { type: 'role'; value: { role: Parameters<Page['getByRole']>[0]; name?: string } }
  | { type: 'text'; value: string }
  | { type: 'locator'; value: string };

export type EmailAction = {
  selector: Selector;
  action: 'click' | 'textContent' | 'getAttribute';
  attributeName?: string;
  description: string;
};

export interface EmailQuery {
  subject?: string;
  from?: string;
  to?: string;
  afterTime?: string; // Format: yyyy-mm-dd hh:mm:ss
  beforeTime?: string; // Format: yyyy-mm-dd hh:mm:ss
}

export interface EmailExtractionRule {
  field: string;
  type: 'between-markers' | 'regex' | 'full-text';
  startMarker?: string;
  endMarker?: string;
  regex?: RegExp;
}