import client from "./client"; export interface UserOut { id: string; username: string; email: string | null; role: string; is_active: boolean; created_at: string | null; last_login: string | null; } export interface UserCreatePayload { username: string; email?: string; password: string; role: string; } export interface UserUpdatePayload { email?: string; role?: string; is_active?: boolean; password?: string; } /** Fetch all users (admin only). */ export async function getUsers(): Promise { const { data } = await client.get("/users"); return data; } /** Create a new user (admin only). */ export async function createUser(payload: UserCreatePayload): Promise { const { data } = await client.post("/users", payload); return data; } /** Update a user (admin only). */ export async function updateUser(userId: string, payload: UserUpdatePayload): Promise { const { data } = await client.patch(`/users/${userId}`, payload); return data; }