/**
 * 补货员相关API
 */
import { post, get } from '../utils/request';

export interface LoginResponse {
  token: string;
  userInfo: any;
}

/**
 * 补货员微信静默登录
 * @param params { code: 微信登录凭证 }
 */
export const loginByWechat = (params: { code: string }): Promise<LoginResponse> => {
  return post<LoginResponse>('/replenisher/login/wechat', params);
};

/**
 * 补货员扫码绑定微信
 * @param params { bindingCode: 绑定码, code: 微信登录凭证 }
 */
export const bindWechat = (params: { bindingCode: string; code: string }): Promise<LoginResponse> => {
  return post<LoginResponse>('/replenisher/login/bind', params);
};

/**
 * 获取当前补货员信息
 */
export const getMyInfo = (): Promise<any> => {
  return get('/replenisher/my-info');
};
