import { vi } from 'vitest';
import { Component, output } from '@angular/core';

// Mock ScannerButtonComponent
// eslint-disable-next-line @angular-eslint/component-selector
@Component({
  selector: 'isa-scanner-button',
  template: '<button>Scan</button>',
  standalone: true,
})
export class MockScannerButtonComponent {
  scanResult = output<string>();
}

// Mock ScannerService
export class MockScannerService {
  scanBarcode = vi.fn().mockResolvedValue('mock-barcode-result');
  configure = vi.fn().mockResolvedValue(undefined);
}

// Mock the entire scanner module
vi.mock('@isa/shared/scanner', () => ({
  ScannerButtonComponent: MockScannerButtonComponent,
  ScannerService: MockScannerService,
}));

// Mock the dialog injection function
vi.mock('@isa/ui/dialog', () => ({
  injectDialog: vi.fn(),
  DialogContentDirective: class MockDialogContentDirective {
    close = vi.fn();
    data: any;
  },
  DialogComponent: class MockDialogComponent {},
}));
