import { Injectable } from '@nestjs/common';
import { InspectorService } from '../inspector/inspector.service';
import { InspectionTaskEntity } from '../tasks/inspection-task.entity';
import { InspectionExecutor } from './executor.types';

@Injectable()
export class BrowserExecutorService implements InspectionExecutor {
  readonly name = 'browser' as const;

  constructor(private readonly inspectorService: InspectorService) {}

  executeTask(
    task: Pick<
      InspectionTaskEntity,
      | 'id'
      | 'name'
      | 'siteUrl'
      | 'stepsJson'
      | 'preferredExecutor'
      | 'allowAgentFallback'
    >,
    traceId: string,
  ) {
    return this.inspectorService.executeTask(task, traceId);
  }
}
