import { axiosClient } from '@/api/axiosClient'
import type { UserDetail, UpdateUserPayload } from '../types'

export async function updateUser(id: number, payload: UpdateUserPayload): Promise<UserDetail> {
  const response = await axiosClient.put<UserDetail>(`/api/v1/users/${id}`, {
    nombre: payload.nombre,
    apellido: payload.apellido,
    email: payload.email,
    rol: payload.rol,
    activo: payload.activo,
  })
  return response.data
}
