import { ResPage } from "@/api/interface/index";
import { PORT1 } from "@/api/config/servicePort";
import http from "@/api";

/**
 * @name 客户管理模块
 */

// 客户列表返回类型
export interface ResContactList {
  id: number;
  name: string;
  phone: string;
  wechat: string;
  position: string;
  importanceLevel: number;
  isValid: boolean;
  remark: string;
  createdAt: string;
}

// 获取联系人列表
export const getContactList = (params: any) => {
  return http.get<ResPage<ResContactList>>(PORT1 + `/contact`, params);
};
// 新增联系人
export const addContact = (params: any) => {
  return http.post<any>(PORT1 + `/contact`, params);
};
// 更新联系人
export const updateContact = (params: any) => {
  return http.put<any>(PORT1 + `/contact/${params.id}`, params);
};
// 失效联系人
export const invalidContact = (params: any) => {
  return http.put<any>(PORT1 + `/contact/invalid/${params.id}`, params);
};
// 默认显示联系人
export const defaultDisplayContact = (params: any) => {
  return http.put<any>(PORT1 + `/contact/default/display/${params.id}`, params);
};