import { Lead, SearchQuery } from '../types';
import { LeadProvider, calculateQualityScore } from './LeadProvider';

export class MockProvider implements LeadProvider {
  name = 'MockData';

  async search(query: SearchQuery): Promise<Lead[]> {
    // Simulate network delay
    await new Promise((resolve) => setTimeout(resolve, 800));

    const mockLeads: Partial<Lead>[] = [
      {
        id: `mock-1-${Date.now()}`,
        name: `Acme ${query.keyword} Corp`,
        category: 'Business Services',
        phone: '+1 (555) 123-4567',
        website: 'https://acme-mock.test',
        email: 'contact@acme-mock.test',
        address: `123 Mock St, ${query.location}`,
      },
      {
        id: `mock-2-${Date.now()}`,
        name: `Global ${query.keyword} Solutions`,
        category: 'Software Engineering',
        phone: '+1 (555) 987-6543',
        website: 'https://global-solutions.test',
        email: 'info@global-solutions.test',
        address: `456 Demo Ave, ${query.location}`,
      },
      {
        id: `mock-3-${Date.now()}`,
        name: `${query.location} ${query.keyword} Local`,
        category: 'Retail & Commerce',
        phone: '+1 (555) 001-1234',
        website: 'https://local-commerce.test',
        email: 'sales@local-commerce.test',
        address: `789 Retail Blvd, ${query.location}`,
      },
    ];

    return mockLeads.map((lead) => ({
      ...lead,
      source: this.name,
      qualityScore: calculateQualityScore(lead),
    })) as Lead[];
  }
}
