import { baseAPI } from "@/lib/API";
import { ServicesType } from "@/lib/types/Services.data";

export const getServices = async (lang: string) => {
  const res = await fetch(`${baseAPI}services`, {
    headers: {
      "Accept-Language": lang,
    },
    next: {
      revalidate: 1000,
      tags: [`services-${lang}`],
    },
  });

  if (!res.ok) throw new Error("Failed to load services");

  return (await res.json()) as ServicesType;
};
