import { apiFetch } from "@/lib/auth/api-client"; import { CreateUserInput, UpdateUserInput, User } from "./types"; export function fetchUsers(): Promise { return apiFetch("/users"); } export function createUser(input: CreateUserInput): Promise { return apiFetch("/users", { method: "POST", body: JSON.stringify(input), }); } export function updateUser(id: string, input: UpdateUserInput): Promise { return apiFetch(`/users/${encodeURIComponent(id)}`, { method: "PATCH", body: JSON.stringify(input), }); } export function resetUserPassword( id: string, password: string, ): Promise { return apiFetch(`/users/${encodeURIComponent(id)}/reset-password`, { method: "POST", body: JSON.stringify({ password }), }); } export function deactivateUser(id: string): Promise { return apiFetch(`/users/${encodeURIComponent(id)}/deactivate`, { method: "POST" }); } export function activateUser(id: string): Promise { return apiFetch(`/users/${encodeURIComponent(id)}/activate`, { method: "POST" }); } export function resetUserMfa(id: string): Promise { return apiFetch(`/users/${encodeURIComponent(id)}/mfa/reset`, { method: "POST" }); }