import { defHttp } from '/@/utils/http/axios';
import {
  selectUserListParam,
  checkDeiceParam,
  addDeiceParam,
  checkUserParam,
  SubAccountUsers,
  selectCompanyParam,
  auditParam,
  addPointParam,
} from './model';
import type { Result } from '/#/axios';

enum Api {
  addDevice = '/service/manage_jp/camera/bind',
  checkDevice = '/service/manage_jp/company/checkDevice',
  selectUserList = '/service/manage_jp/company/selectUserList',
  addPoint = '/service/manage_jp/company/addPoint',
  checkUserAddAble = '/service/manage_jp/company/checkUserAddAble',
  saveSubUsers = '/service/manage_jp/company/saveSubUsers',
  selectCompanyById = '/service/manage_jp/company/findById',
  auditCompany = '/service/manage_jp/company/auditCompany',
}
/**
 * @description: Get sample list value
 */

export const AddDevice = (params: addDeiceParam) =>
  defHttp.post<Result>({
    url: Api.addDevice,
    params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });

export const checkDevice = (params: checkDeiceParam) =>
  defHttp.post<Result>(
    {
      url: Api.checkDevice,
      params,
      headers: {
        // @ts-ignore
        ignoreCancelToken: true,
      },
    },
    {
      errorMessageMode: 'none',
    },
  );
export const auditCompany = (params: auditParam) =>
  defHttp.post<Result>({
    url: Api.auditCompany,
    params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });

export const addPoint = (params: addPointParam) =>
  defHttp.post<Result>({
    url: Api.addPoint,
    params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });
export const selectUserList = (params: selectUserListParam) =>
  defHttp.post<Result>({
    url: Api.selectUserList,
    params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });

export const checkUserAddAble = (params: checkUserParam) =>
  defHttp.post<Result>({
    url: Api.checkUserAddAble,
    params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });

export const selectCompanyById = (params: selectCompanyParam) =>
  defHttp.post<Result>({
    url: Api.selectCompanyById,
    params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });

export const saveSubUsers = (params: SubAccountUsers) =>
  defHttp.post<Result>({
    url: Api.saveSubUsers,
    params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });
