import { apiClient } from "@/core/api";
import { meStatusSchema, type MeStatus } from "@customer-portal/domain/dashboard";

export async function getMeStatus(): Promise<MeStatus> {
  const response = await apiClient.GET<MeStatus>("/api/me/status");
  if (!response.data) {
    throw new Error("Status response was empty");
  }
  const parsed = meStatusSchema.safeParse(response.data);
  if (!parsed.success) {
    throw new Error("Status response failed validation");
  }
  return parsed.data;
}
