import { ExploreFilterId } from "@/constants/exploreFilters";
import { USER_LEVELS } from "@/lib/userLevel";

export type PostFetchFilters = {
  expertise?: string;
  userLevel?: string;
  exploreFilter?: string;
  subExpertise?: string;
  lat?: string;
  lng?: string;
};

export function buildExplorePostFilters(
  filter: ExploreFilterId,
  coords?: { lat: number; lng: number } | null
): PostFetchFilters {
  switch (filter) {
    case "model":
      return { exploreFilter: "model", expertise: "مدل" };
    case "photographer":
      return { exploreFilter: "photographer", expertise: "عکاس" };
    case "hairstylist":
      return { exploreFilter: "hairstylist", expertise: "آرایشگر" };
    case "makeup":
      return { exploreFilter: "makeup", subExpertise: "میکاپ" };
    case "professional":
      return { exploreFilter: "professional", userLevel: USER_LEVELS.PRO };
    case "trending":
      return { exploreFilter: "trending" };
    case "best_month":
      return { exploreFilter: "best_month" };
    case "near_me":
      if (coords) {
        return {
          exploreFilter: "near_me",
          lat: String(coords.lat),
          lng: String(coords.lng),
        };
      }
      return { exploreFilter: "near_me" };
    default:
      return {};
  }
}
