import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { TenantOrganizationVO, TenantOrganizationForm, TenantOrganizationQuery } from '@/api/business/tenantOrganization/types';

/**
 * 查询合作组织列表
 * @param query
 * @returns {*}
 */

export const listTenantOrganization = (query?: TenantOrganizationQuery): AxiosPromise<TenantOrganizationVO[]> => {
  return request({
    url: '/business/tenantOrganization/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询合作组织详细
 * @param id
 */
export const getTenantOrganization = (id: string | number): AxiosPromise<TenantOrganizationVO> => {
  return request({
    url: '/business/tenantOrganization/' + id,
    method: 'get'
  });
};

/**
 * 新增合作组织
 * @param data
 */
export const addTenantOrganization = (data: TenantOrganizationForm) => {
  return request({
    url: '/business/tenantOrganization',
    method: 'post',
    data: data
  });
};

/**
 * 修改合作组织
 * @param data
 */
export const updateTenantOrganization = (data: TenantOrganizationForm) => {
  return request({
    url: '/business/tenantOrganization',
    method: 'put',
    data: data
  });
};

/**
 * 删除合作组织
 * @param id
 */
export const delTenantOrganization = (id: string | number | Array<string | number>) => {
  return request({
    url: '/business/tenantOrganization/' + id,
    method: 'delete'
  });
};
