import { db } from './index';
import { spanLabelTypes } from './schema';

export async function seedSpanLabelTypes() {
  const defaultTypes = [
    { name: 'bull_flag', display_name: 'Bull Flag', color: '#4CAF50', hotkey: '1', sort_order: 1 },
    { name: 'bear_flag', display_name: 'Bear Flag', color: '#F44336', hotkey: '2', sort_order: 2 },
    { name: 'head_and_shoulders', display_name: 'Head and Shoulders', color: '#9C27B0', hotkey: '3', sort_order: 3 },
    { name: 'double_bottom', display_name: 'Double Bottom', color: '#2196F3', hotkey: '4', sort_order: 4 },
    { name: 'wedge_up', display_name: 'Wedge Up', color: '#FF9800', hotkey: '5', sort_order: 5 },
    { name: 'wedge_down', display_name: 'Wedge Down', color: '#FF5722', hotkey: '6', sort_order: 6 },
    { name: 'custom', display_name: 'Custom', color: '#607D8B', hotkey: '7', sort_order: 7 },
  ];

  // Check if types already exist
  const existing = await db.select().from(spanLabelTypes);

  if (existing.length === 0) {
    await db.insert(spanLabelTypes).values(defaultTypes);
    console.log('Seeded default span label types');
  } else {
    console.log('Span label types already exist, skipping seed');
  }
}
