import { defHttp } from '/@/utils/http/axios';
import { PageParams, userList } from './model';
import { Result } from '/#/axios';

enum Api {
  allList = '/service/manage/jyPlatform/allList',
  list = '/service/manage/jyPlatform/list',
  addOrUpdate = '/service/manage/jyPlatform/addOrUpdate',
  enable = '/service/manage/jyPlatform/enable',
  disable = '/service/manage/jyPlatform/disable',
  del = '/service/manage/jyPlatform/del',
  queryByKey = '/service/manage/jyUserPlatform/queryByKey',
  jyUserPlatformadd = '/service/manage/jyUserPlatform/add',
  addWaitUser = '/service/manage/jyUserPlatform/addWaitUser',
  yhlist = '/service/manage/jyUserPlatform/list',
  yhadd = '/service/manage/jyUserPlatform/add',
  yhupdate = '/service/manage/jyUserPlatform/update',
  yhdel = '/service/manage/jyUserPlatform/del',
  addressKey = '/service/manage/index/addressKey/',
  sceneGroupCount = '/service/manage/scene/sceneGroupCount/',
}

/**
 * @description: Get sample list value
 */

export const allList = (params: PageParams) =>
  defHttp.get<userList>({
    url: Api.allList,
    params: params,
    // data: params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });

export const sceneGroupCount = ({ type = 'platform' }) =>
  defHttp.get<userList>({
    url: Api.sceneGroupCount + type,
    params: {},
    // data: params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });

export const jyPlatformlist = (params: PageParams) =>
  defHttp.post({
    url: Api.list,
    params: params,
    // data: params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });
export const delplatformList = (params) =>
  defHttp.post<Result>({
    url: Api.del,
    params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });
export const addOrUpdate = (params: PageParams) =>
  defHttp.post<userList>({
    url: Api.addOrUpdate,
    params: params,
    // data: params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });

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

//权益详情
export const jyUserPlatformadd = (params: PageParams) =>
  defHttp.post<userList>({
    url: Api.jyUserPlatformadd,
    params: params,
    // data: params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });
export const addWaitUser = (params: PageParams) =>
  defHttp.post<userList>({
    url: Api.addWaitUser,
    params: params,
    // data: params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });

//权益详情
export const disable = (params: PageParams) =>
  defHttp.post<userList>({
    url: Api.disable,
    params: params,
    // data: params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });

//权益延期
export const enable = (params: PageParams) =>
  defHttp.post<userList>({
    url: Api.enable,
    params: params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });

//权益延期
export const yhList = (params: PageParams) =>
  defHttp.post<userList>({
    url: Api.yhlist,
    params: params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });

//添加用户权益
export const AddUserIncrementApi = (params: PageParams) =>
  defHttp.post<userList>({
    url: Api.addUserIncrement,
    params: params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });

//加用户下载次数
export const AddDownNumApi = (params: PageParams) =>
  defHttp.post<userList>({
    url: Api.addDownNum,
    params: params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });

//获取相机详情
export const GetCameraDetailApi = (params: PageParams) =>
  defHttp.post<userList>({
    url: Api.getCameraDetail,
    params: params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });

//相机解绑
export const addressKey = (address) =>
  defHttp.get<userList>({
    url: Api.addressKey + address,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });

//相机解绑
export const platformallList = (params: PageParams) =>
  defHttp.get<userList>({
    url: Api.platformallList,
    params: params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });
