import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { IndustryCategoryVO, IndustryCategoryForm, IndustryCategoryQuery } from '@/api/customer/customerCategory/industryCategory/types';

/**
 * 查询所属行业列表
 * @param query
 * @returns {*}
 */

export const listIndustryCategory = (query?: IndustryCategoryQuery): AxiosPromise<IndustryCategoryVO[]> => {
  return request({
    url: '/customer/industryCategory/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询所属行业详细
 * @param id
 */
export const getIndustryCategory = (id: string | number): AxiosPromise<IndustryCategoryVO> => {
  return request({
    url: '/customer/industryCategory/' + id,
    method: 'get'
  });
};

/**
 * 新增所属行业
 * @param data
 */
export const addIndustryCategory = (data: IndustryCategoryForm) => {
  return request({
    url: '/customer/industryCategory',
    method: 'post',
    data: data
  });
};

/**
 * 修改所属行业
 * @param data
 */
export const updateIndustryCategory = (data: IndustryCategoryForm) => {
  return request({
    url: '/customer/industryCategory',
    method: 'put',
    data: data
  });
};

/**
 * 删除所属行业
 * @param id
 */
export const delIndustryCategory = (id: string | number | Array<string | number>) => {
  return request({
    url: '/customer/industryCategory/' + id,
    method: 'delete'
  });
};
