import api from '@/core/api/axios';
import type { PageResponse } from '@/core/api/api.types';
const BASE = '/api/wtm/users';
export const userService = {
  getAll: (params?: Record<string, unknown>) => api.get<PageResponse<unknown>>(`${BASE}`, { params }),
  getById: (id: number) => api.get(`${BASE}/${id}`),
  update: (id: number, data: unknown) => api.put(`${BASE}/${id}`, data),
  updateRoles: (id: number, roles: unknown) => api.put(`${BASE}/${id}/roles`, roles),
  uploadInternal: (file: File) => { const f = new FormData(); f.append('file', file); return api.post(`${BASE}/upload/internal`, f); },
  uploadSubcontractor: (file: File) => { const f = new FormData(); f.append('file', file); return api.post(`${BASE}/upload/subcontractor`, f); },
  downloadTemplate: () => api.get(`${BASE}/upload/template`, { responseType: 'blob' }),
};
