import { request } from '@/api';
import type {
  UserInfo,
  EditLangTypeParams,
  BindMobileParams,
  BindEmailParams,
  EditUsernameParams,
  UpdatePwdByCaptchaParams
} from '@/api/types/profile';

// 获取用户信息
export async function getUserInfoApi(): Promise<UserInfo> {
  return request.get<UserInfo>('/user/getUserInfo');
}

// 修改语言类型
export async function editLangTypeApi(params: EditLangTypeParams): Promise<void> {
  return request.post('/user/editLangType', params);
}

// 绑定手机号
export async function bindMobileApi(data: BindMobileParams): Promise<void> {
  return request.post('/user/bindMobile', data);
}

// 绑定邮箱
export async function bindEmailApi(data: BindEmailParams): Promise<void> {
  return request.post('/user/bindEmail', data);
}

// 修改用户名
export async function editUsernameApi(data: EditUsernameParams): Promise<void> {
  return request.post('/user/editUserName', data);
}

// 验证码修改密码（统一接口）
export async function updatePwdByCaptchaApi(data: UpdatePwdByCaptchaParams): Promise<void> {
  return request.post('/user/editLoginPass', data);
}