import { RecordCompanyForm, RecordCompanyQuery, RecordCompanyVO, BindInfoRemoveBo, AdminOperateUserBo, QueryUserBindInfoBo } from '@/api/enterprise/recordCompany/types';
import request from '@/utils/request';
import { AxiosPromise } from 'axios';

/**
 * 查询企业备案信息列表
 * @param query
 * @returns {*}
 */

export const listRecordCompany = (query?: RecordCompanyQuery): AxiosPromise<RecordCompanyVO[]> => {
    return request({
        url: '/company/listByPage',
        method: 'get',
        params: query
    });
};

/**
 * 查询企业备案信息详细
 * @param id
 */
export const getRecordCompany = (id: string | number): AxiosPromise<RecordCompanyVO> => {
    return request({
        url: '/company/detail/' + id,
        method: 'get'
    });
};

/**
 * 新增企业备案信息
 * @param data
 */
export const addRecordCompany = (data: RecordCompanyForm) => {
    return request({
        url: '/enterprise/recordCompany/add',
        method: 'post',
        data: data
    });
};

/**
 * 修改企业备案信息
 * @param data
 */
export const updateRecordCompany = (data: RecordCompanyForm) => {
    return request({
        url: '/company/adminModify',
        method: 'post',
        data: data
    });
};

/**
 * 删除企业备案信息
 * @param id
 */
export const delRecordCompany = (id: string | number | Array<string | number>) => {
    return request({
        url: '/enterprise/recordCompany/remove/' + id,
        method: 'get'
    });
};
/**
 * 企业备案审批
 * @param data
 */
export const companyApproval = (data: RecordCompanyForm) => {
    return request({
        url: '/approval/approvalCpy',
        method: 'post',
        data: data
    });
};

export const listByUserId = (userId: string | number): AxiosPromise<any> => {
    return request({
        url: '/company/listByUserId/' + userId,
        method: 'get'
    });
};

export const removeBindUser = (data: BindInfoRemoveBo): AxiosPromise<any> => {
    return request({
        url: '/bindInfo/removeUser',
        method: 'post',
        data
    });
};
export const adminAddUserForCpy = (data: AdminOperateUserBo): AxiosPromise<any> => {
    return request({
        url: '/bindInfo/adminAddUserForCpy',
        method: 'get',
        params: data
    });
};

/**
 * 查询用户绑定信息列表
 * @param query
 * @returns {*}
 */
export const listUserBindInfo = (query?: QueryUserBindInfoBo): AxiosPromise<any> => {
    return request({
        url: '/bindInfo/listByPageAll',
        method: 'get',
        params: query
    });
};