/**
 * Test script to verify AI recommendation type derivation
 * 
 * Run with: node test-recommendation-types.js
 */

const testCases = [
  {
    name: 'Private Guide Service',
    slug: 'private_guide',
    expectedType: 'private_guide',
  },
  {
    name: 'Driver Car Service',
    slug: 'driver_car',
    expectedType: 'driver_car',
  },
  {
    name: 'Activity Bundle',
    slug: 'activity_bundle',
    expectedType: 'activity_bundle',
  },
  {
    name: 'Red Tour',
    slug: 'red_tour',
    expectedType: 'daily_tour',
  },
  {
    name: 'Green Tour',
    slug: 'green_tour',
    expectedType: 'daily_tour',
  },
  {
    name: 'Blue Tour',
    slug: 'blue_tour',
    expectedType: 'daily_tour',
  },
  {
    name: 'Balloon Day',
    slug: 'balloon_day',
    expectedType: 'daily_tour',
  },
];

// Type derivation logic (same as in edge function)
function deriveTypeFromSlug(slug) {
  if (slug === 'private_guide') {
    return 'private_guide';
  } else if (slug === 'driver_car') {
    return 'driver_car';
  } else if (slug === 'activity_bundle') {
    return 'activity_bundle';
  } else {
    // All other slugs are daily tours
    return 'daily_tour';
  }
}

// Run tests
console.log('🧪 Testing AI Recommendation Type Derivation\n');

let passed = 0;
let failed = 0;

testCases.forEach((test) => {
  const result = deriveTypeFromSlug(test.slug);
  const success = result === test.expectedType;
  
  if (success) {
    console.log(`✅ ${test.name}: ${test.slug} → ${result}`);
    passed++;
  } else {
    console.log(`❌ ${test.name}: ${test.slug} → ${result} (expected: ${test.expectedType})`);
    failed++;
  }
});

console.log(`\n📊 Results: ${passed} passed, ${failed} failed`);

if (failed === 0) {
  console.log('🎉 All tests passed!');
  process.exit(0);
} else {
  console.log('❌ Some tests failed!');
  process.exit(1);
}
