import { api } from "./client";

export interface PwaSupportContact {
  tg_username: string | null;
  phone: string | null;
}

export interface Me {
  id: number;
  name: string;
  email?: string | null;
  permissions: string[];
  // Модуль СТО (У10 + У34) — расширение в backend PR-4.
  is_admin: boolean;
  can_login_pwa: boolean;
  departments: string[];
  support: PwaSupportContact;
}

export async function getMe(): Promise<Me> {
  return api.get("me").json<Me>();
}
