import axiosInstance from "@/apis/axios.config";
import type {UserRegisterDTO, UserUpdateDTO, PasswordChangeDTO} from "@/types/dto";

const USER_PREFIX = "/api/user"

const userApis = {
    findUserById: (id:number) => {
        return axiosInstance.get(`${USER_PREFIX}`, {
            params: {
                id
            }
        })
    },

    register: (userRegisterDTO: UserRegisterDTO) => {
        return axiosInstance.post(`${USER_PREFIX}/register`, userRegisterDTO)
    },

    updateUser: (id:number, userUpdateDTO:UserUpdateDTO) => {
        return axiosInstance.put(`${USER_PREFIX}`, userUpdateDTO, {
            params: {
                id: id,
            }
        })
    },

    updatePassword: (passwordChangeDTO: PasswordChangeDTO) => {
        return axiosInstance.post(`${USER_PREFIX}/updatePassword`, passwordChangeDTO)
    }

}

export default userApis
