export async function fetchDefaultEnterpriseId(accessToken: string): Promise<string | null> {
  try {
    const resp = await fetch("/api/v1/enterprise/enterprises", {
      headers: { Authorization: `Bearer ${accessToken}` },
    });
    if (!resp.ok) {
      return null;
    }
    const data = (await resp.json()) as Array<{ id: string }>;
    if (!Array.isArray(data) || !data.length) {
      return null;
    }
    return data[0]?.id ?? null;
  } catch {
    return null;
  }
}
