import { gallery as fallbackGallery, services as fallbackServices } from "./data";
import { createClient, isSupabaseConfigured } from "./supabase/server";
import type { GalleryItem, Service } from "./types";
import { listPhotos } from "./gallery-store";
import { getInstagramGallery } from "./instagram";
export async function getServices():Promise<Service[]>{if(!isSupabaseConfigured())return fallbackServices;const s=await createClient();const {data}=await s.from("services").select("*").eq("active",true).order("sort_order");if(!data?.length)return fallbackServices;return data.map(x=>({id:x.id,name:x.name,category:x.category,description:x.description,price:x.price_cents/100,duration:x.duration_minutes,featured:x.featured}));}
export async function getGallery():Promise<GalleryItem[]>{const [instagram,managed]=await Promise.all([getInstagramGallery(),listPhotos()]);return [...instagram,...managed.filter(p=>p.published).sort((a,b)=>a.order-b.order)];}
