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

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

// 客户列表返回类型
export interface ResCustomerList {
  id: number;
  name: string;
  introducer: string;
  baseLocation: string;
  type: string;
  createdAt: string;
  isValid: boolean;
  contactName: string;
  nextRemindTime: string;
  latestFollowTime: string;
}

// 获取客户列表
export const getCustomerList = (params: any) => {
  return http.get<ResPage<ResCustomerList>>(PORT1 + `/customer`, params);
};

// 新增客户
export const addCustomer = (params: any) => {
  return http.post<any>(PORT1 + `/customer`, params);
};

// 获取客户详情
export const getCustomerDetail = (params: any) => {
  return http.get<any>(PORT1 + `/customer/detail/${params.id}`, params);
};

// 更新客户
export const updateCustomer = (params: any) => {
  return http.put<any>(PORT1 + `/customer/${params.id}`, params);
};
// 失效客户
export const invalidCustomer = (params: any) => {
  return http.put<any>(PORT1 + `/customer/invalid/${params.id}`, params);
};
export const cancelCustomer = (params: any) => {
  return http.put<any>(PORT1 + `/customer/cancel/latest/remind/${params.id}`, params);
};
