// Define fixed categories
export const FEE_SCHEDULE_CATEGORIES = [
  "Management",
  "Maintenance",
  "Labor",
  "Materials",
  "Service",
  "Expense"
];

// Define shared subcategories (these are now seeded in DB, but kept here for reference or fallback)
export const SHARED_SUBCATEGORIES = [
  "Collections",
  "Administrative",
  "Postage",
  "Copies",
  "Office Supplies",
  "Violations"
];

/**
 * Returns subcategories for a specific category.
 * In this new model, all categories share the same pool of subcategories.
 * @param {string} category 
 * @returns {string[]}
 */
export const getCategorySubcategories = (category) => {
  // Currently returning shared list, but structure allows for future category-specific logic
  return SHARED_SUBCATEGORIES;
};

/**
 * Helper to combine static shared subcategories with any custom ones fetched from DB
 * @param {Array} dbSubcategories - List of subcategory objects from DB
 * @returns {Array} - Combined list of unique subcategory names
 */
export const getAvailableSubcategories = (dbSubcategories = []) => {
  const dbNames = dbSubcategories.map(s => s.name);
  // Merge and deduplicate
  return [...new Set([...SHARED_SUBCATEGORIES, ...dbNames])].sort();
};