/** Matches backend CafeDiscoverProfileKeys — labels via i18n discoverProfile.* */

export type CafeDiscoverProfile = {
  themes: string[];
  size: string | null;
  floors: string | null;
  vibes: string[];
  occasions: string[];
  spaceFeatures: string[];
  noiseLevel: string | null;
  priceTier: string | null;
};

export const EMPTY_DISCOVER_PROFILE: CafeDiscoverProfile = {
  themes: [],
  size: null,
  floors: null,
  vibes: [],
  occasions: [],
  spaceFeatures: [],
  noiseLevel: null,
  priceTier: null,
};

export const DISCOVER_TAXONOMY = {
  themes: [
    "modern", "minimal", "vintage", "industrial", "scandi",
    "persian_traditional", "book_cafe", "roastery", "dessert_focus",
    "brunch", "late_night", "plants_heavy", "instagrammable", "heritage",
    "luxury", "specialty_coffee", "tea_house", "art_gallery", "sport_cafe", "gaming_cafe",
  ],
  sizes: ["tiny", "cozy", "medium", "large", "spacious"],
  floors: ["one", "two", "three", "multi"],
  vibes: [
    "quiet", "lively", "romantic", "cozy", "trendy",
    "traditional", "artistic", "luxury", "casual", "study_friendly",
  ],
  occasions: [
    "date", "family", "friends", "finding_someone", "solo",
    "business_meeting", "study_work", "celebration", "quick_coffee",
    "breakfast", "brunch", "after_dinner", "group_large",
  ],
  spaceFeatures: [
    "indoor", "outdoor", "terrace", "rooftop", "garden", "plants",
    "wifi", "parking", "wheelchair", "kids_friendly", "pet_friendly",
    "smoking_area", "live_music", "private_room", "counter_only",
    "takeaway", "hookah", "board_games", "no_smoking", "prayer_room",
  ],
  noiseLevels: ["quiet", "moderate", "lively"],
  priceTiers: ["budget", "mid", "premium"],
} as const;

export type DiscoverListField = keyof Pick<
  CafeDiscoverProfile,
  "themes" | "vibes" | "occasions" | "spaceFeatures"
>;

export type DiscoverSingleField = keyof Pick<
  CafeDiscoverProfile,
  "size" | "floors" | "noiseLevel" | "priceTier"
>;

export function toggleListValue(list: string[], id: string): string[] {
  return list.includes(id) ? list.filter((x) => x !== id) : [...list, id];
}
