import http from "@/api";

/**
 * @name 好友关系管理模块
 */

// 获取好友关系列表
export const getFriendRelationList = (params: any) => {
  return http.post(`/api/friendRelation/list`, params);
};

// 添加好友
export const addFriendRelation = (params: {
  friendName: string;
  friendPhone: string;
  remark?: string;
  relationType: string | number;
  couponList?: Array<{ couponId: string | number; quantity: number }>;
}) => {
  return http.post(`/api/friendRelation/add`, params);
};

// 编辑好友信息
export const updateFriendRelation = (params: {
  id: string | number;
  friendName: string;
  friendPhone: string;
  remark?: string;
  relationType: string | number;
  couponList?: Array<{ couponId: string | number; quantity: number }>;
}) => {
  return http.post(`/api/friendRelation/update`, params);
};

// 删除好友
export const deleteFriendRelation = (params: { id: string | number }) => {
  return http.post(`/api/friendRelation/delete`, params);
};

// 同意好友申请
export const approveFriend = (params: { id: string | number }) => {
  return http.post(`/api/friendRelation/approve`, params);
};

// 拒绝好友申请
export const rejectFriend = (params: { id: string | number; reason?: string }) => {
  return http.post(`/api/friendRelation/reject`, params);
};
