// Form options and data for EditPage component

// Main categories with their subcategories
export const categoryStructure = [
  {
    label: 'Career',
    value: 'career',
    subcategories: [
      { label: 'Promotion', value: 'career-promotion' },
      { label: 'Retirement', value: 'career-retirement' },
      { label: 'Career Changes', value: 'career-changes' }
    ]
  },
  {
    label: 'Education',
    value: 'education',
    subcategories: [
      { label: 'Graduation', value: 'education-graduation' },
      { label: 'Schooling', value: 'education-schooling' }
    ]
  },
  {
    label: 'Awards',
    value: 'awards',
    subcategories: []
  },
  {
    label: 'Personal Celebrations',
    value: 'personal-celebrations',
    subcategories: [
      { label: 'Birthday', value: 'birthday' },
      { label: 'Anniversary', value: 'anniversary' }
    ]
  },
  {
    label: 'Relationships',
    value: 'relationships',
    subcategories: [
      { label: 'Engagement', value: 'relationships-engagement' },
      { label: 'Marriage', value: 'relationships-marriage' },
      { label: 'Divorce', value: 'relationships-divorce' }
    ]
  },
  {
    label: 'Parenthood',
    value: 'parenthood',
    subcategories: [
      { label: 'Pregnancy', value: 'parenthood-pregnancy' },
      { label: 'Birth', value: 'parenthood-birth' },
      { label: 'Adoption', value: 'parenthood-adoption' }
    ]
  },
  {
    label: 'Loss & Passing',
    value: 'passing',
    subcategories: [
      { label: 'Funeral', value: 'passing-funeral' }
    ]
  },
  {
    label: 'Festivities',
    value: 'festivities',
    subcategories: [
      { label: 'Christmas', value: 'festivities-christmas' },
      { label: 'Thanksgiving', value: 'festivities-thanksgiving' },
      { label: 'New Year', value: 'festivities-new-year' },
      { label: 'Easter', value: 'festivities-easter' },
      { label: 'Holidays', value: 'festivities-holidays' }
    ]
  },
  {
    label: 'Social Events',
    value: 'social-events',
    subcategories: [
      { label: 'Reunions', value: 'reunions' },
      { label: 'Concerts', value: 'concerts' },
      { label: 'Sports', value: 'sports' },
      { label: 'Festivals', value: 'festivals' }
    ]
  },
  {
    label: 'Community',
    value: 'community',
    subcategories: [
      { label: 'Charity', value: 'charity' },
      { label: 'Community Service', value: 'community-service' }
    ]
  },
  {
    label: 'Health',
    value: 'health',
    subcategories: [
      { label: 'Surgery', value: 'health-surgery' },
      { label: 'Illness', value: 'health-illness' },
      { label: 'Recovery', value: 'health-recovery' },
      { label: 'Transplants', value: 'health-transplants' },
      { label: 'Mental Health', value: 'health-mental-health' }
    ]
  },
  {
    label: 'Religious & Spiritual',
    value: 'religious',
    subcategories: [
      { label: 'Baptism', value: 'religious-baptism' },
      { label: 'Bar/Bat Mitzvah', value: 'religious-bar-bat-mitzvah' },
      { label: 'Communion', value: 'religious-communion' },
      { label: 'Confirmation', value: 'religious-confirmation' },
      { label: 'Pilgrimage', value: 'religious-pilgrimage' }
    ]
  },
  {
    label: 'Travel & Adventure',
    value: 'travel',
    subcategories: [
      { label: 'Travel', value: 'travel-general' },
      { label: 'Vacation', value: 'vacation' },
      { label: 'Adventure', value: 'adventure' }
    ]
  },
  {
    label: 'Life Changes',
    value: 'life-changes',
    subcategories: [
      { label: 'Moving', value: 'moving' },
      { label: 'License', value: 'license' },
      { label: 'Voting', value: 'voting' },
      { label: 'Citizenship', value: 'citizenship' }
    ]
  },
  {
    label: 'Milestones',
    value: 'milestones',
    subcategories: []
  }
]

// Flattened category options for backward compatibility and simple select usage
export const categoryOptions = categoryStructure.reduce((acc, category) => {
  // Add main category if it has no subcategories
  if (category.subcategories.length === 0) {
    acc.push({ label: category.label, value: category.value })
  } else {
    // Add subcategories with main category prefix
    category.subcategories.forEach(sub => {
      acc.push({ 
        label: `${category.label} - ${sub.label}`, 
        value: sub.value,
        mainCategory: category.value,
        subcategory: sub.value
      })
    })
  }
  return acc
}, [])

// Helper functions for category management
export const getCategoryStructure = () => categoryStructure

export const getMainCategories = () => {
  return categoryStructure.map(cat => ({
    label: cat.label,
    value: cat.value
  }))
}

export const getSubcategories = (mainCategoryValue) => {
  const mainCategory = categoryStructure.find(cat => cat.value === mainCategoryValue)
  return mainCategory ? mainCategory.subcategories : []
}

export const getCategoryByValue = (value) => {
  return categoryOptions.find(cat => cat.value === value)
}

export const getMainCategoryFromValue = (value) => {
  const category = getCategoryByValue(value)
  return category ? category.mainCategory : null
}

export const tagOptions = [
  // Emotions
  'happy', 'sad', 'exciting', 'stressful', 'memorable', 'important',
  'fun', 'challenging', 'rewarding', 'disappointing', 'surprising',
  'life-changing', 'routine', 'special', 'difficult', 'joyful',
  'overwhelming', 'peaceful', 'anxious', 'proud', 'grateful',
  'emotional', 'touching', 'inspiring', 'motivating', 'healing',
  
  // Significance
  'milestone', 'achievement', 'breakthrough', 'turning-point',
  'first-time', 'last-time', 'once-in-a-lifetime', 'unexpected',
  'planned', 'spontaneous', 'tradition', 'new-experience',
  
  // Social
  'family', 'friends', 'colleagues', 'community', 'solo',
  'group', 'intimate', 'public', 'private', 'celebration',
  
  // Intensity
  'intense', 'mild', 'dramatic', 'subtle', 'overwhelming',
  'gradual', 'sudden', 'anticipated', 'shocking', 'gentle',
  
  // Time-related
  'brief', 'extended', 'momentary', 'lasting', 'temporary',
  'permanent', 'seasonal', 'annual', 'weekly', 'daily'
]

export const personOptions = [
  'Anna Mueller',
  'Max Schmidt',
  'Sarah Johnson',
  'Michael Weber',
  'Lisa Anderson',
  'Thomas Brown',
  'Julia Martinez',
  'David Wilson',
  'Emma Garcia',
  'Robert Davis'
]

export const defaultFormData = {
  keyImage: null,
  keyImageUrl: '',
  additionalImages: [],
  additionalImageUrls: [],
  level: 0,
  categories: [],
  headline: '',
  subheadline: '',
  text: '',
  tags: [],
  location: '',
  date: '',
  time: '',
  audioFiles: [],
  audioRecordings: [],
  videoFiles: [],
  videoRecordings: [],
  relatedPersons: []
}