// Provider system types

export interface ProviderService {
  id: string;
  provider_id: string;
  destinations: string[];
  activity_categories: string[];
  business_name: string | null;
  business_description: string | null;
  business_logo: string | null;
  created_at: string;
  updated_at: string;
}

export interface ProviderWallet {
  id: string;
  provider_id: string;
  credit_balance: number;
  created_at: string;
  updated_at: string;
}

export interface CreditTransaction {
  id: string;
  provider_id: string;
  amount: number;
  transaction_type: 'credit_purchase' | 'lead_purchase' | 'refund';
  description: string | null;
  reference_id: string | null;
  balance_after: number;
  created_at: string;
}

export interface LeadPurchase {
  id: string;
  provider_id: string;
  lead_id: string;
  credits_spent: number;
  purchased_at: string;
}

// Lead with preview/full access control
export interface LeadPreview {
  id: string;
  trip_id: string;
  destination: string;
  start_date: string;
  end_date: string;
  number_of_travelers: number;
  interests: string[];
  planned_activities: PlannedActivity[];
  timeline_snapshot: TimelineSnapshot[];
  
  // Blurred in preview
  email_preview: string; // e.g., "j***@example.com"
  whatsapp_preview: string; // e.g., "+90 5** *** ****"
  
  // Full details (only after purchase)
  email?: string;
  whatsapp?: string;
  country?: string;
  
  // Purchase status
  is_purchased: boolean;
  purchased_at?: string;
  
  created_at: string;
}

// Planned Activity Structure
export interface PlannedActivity {
  place_id: string;
  name: string;
  type?: string;
  day_number: number;
  order_index: number;
  duration?: string;
  time_block?: 'dawn' | 'morning' | 'afternoon' | 'evening';
  lat?: number;
  lng?: number;
}

// Timeline Snapshot Structure
export interface TimelineSnapshot {
  day_number: number;
  date?: string;
  events: Array<{
    place_id: string;
    name: string;
    start_time: string;
    end_time: string;
    duration_minutes: number;
    order_index: number;
  }>;
}

// Filter options for lead marketplace
export interface LeadFilters {
  destinations?: string[];
  start_date_from?: string;
  start_date_to?: string;
  min_travelers?: number;
  max_travelers?: number;
  activity_categories?: string[];
}
