import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { SysCompanyVO, SysCompanyForm, SysCompanyQuery } from '@/api/company/sysCompany/types';

/**
 * 查询公司信息列表
 * @param query
 * @returns {*}
 */

export const listSysCompany = (query?: SysCompanyQuery): AxiosPromise<SysCompanyVO[]> => {
  return request({
    url: '/system/sysCompany/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询公司信息详细
 * @param id
 */
export const getSysCompany = (id: string | number): AxiosPromise<SysCompanyVO> => {
  return request({
    url: '/system/sysCompany/' + id,
    method: 'get'
  });
};

/**
 * 新增公司信息
 * @param data
 */
export const addSysCompany = (data: SysCompanyForm) => {
  return request({
    url: '/system/sysCompany',
    method: 'post',
    data: data
  });
};

/**
 * 修改公司信息
 * @param data
 */
export const updateSysCompany = (data: SysCompanyForm) => {
  return request({
    url: '/system/sysCompany',
    method: 'put',
    data: data
  });
};

/**
 * 删除公司信息
 * @param id
 */
export const delSysCompany = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/sysCompany/' + id,
    method: 'delete'
  });
};
