// @ts-ignore
/* eslint-disable */
import { request } from '@umijs/max';

/** 创建基础Device POST /device/createDevice */
export async function postDeviceCreateDevice(body: API.Device, options?: { [key: string]: any }) {
  return request<API.Response & { msg?: string }>(`/api/v1/device/createDevice`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 删除Device DELETE /device/deleteDevice */
export async function deleteDeviceDeleteDevice(body: API.Device, options?: { [key: string]: any }) {
  return request<API.Response & { msg?: string }>(`/api/v1/device/deleteDevice`, {
    method: 'DELETE',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 删除选中Device DELETE /device/deleteDeviceByIds */
export async function deleteDeviceDeleteDeviceByIds(
  body: API.IdsReq,
  options?: { [key: string]: any },
) {
  return request<API.Response & { msg?: string }>(`/api/v1/device/deleteDeviceByIds`, {
    method: 'DELETE',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 根据id获取Device POST /device/getDeviceById */
export async function postDeviceGetDeviceById(body: API.GetById, options?: { [key: string]: any }) {
  return request<API.Response & { data?: API.DeviceDeviceResponse }>(
    `/api/v1/device/getDeviceById`,
    {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      data: body,
      ...(options || {}),
    },
  );
}

/** 获取Device外键列表 POST /device/getDeviceFkSelect */
export async function postDeviceGetDeviceFkSelect(
  body: API.GetFkSelect,
  options?: { [key: string]: any },
) {
  return request<API.Response & { data?: API.FkResult; msg?: string }>(
    `/api/v1/device/getDeviceFkSelect`,
    {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      data: body,
      ...(options || {}),
    },
  );
}

/** 分页获取Device列表 POST /device/getDeviceList */
export async function postDeviceGetDeviceList(
  body: API.SearchDeviceParams,
  options?: { [key: string]: any },
) {
  return request<API.Response & { data?: API.PageResult; msg?: string }>(
    `/api/v1/device/getDeviceList`,
    {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      data: body,
      ...(options || {}),
    },
  );
}

/** 获得Device名称列表 POST /device/getDeviceNames */
export async function postDeviceGetDeviceNames(body: API.IdsReq, options?: { [key: string]: any }) {
  return request<API.Response & { data?: API.NamesResult; msg?: string }>(
    `/api/v1/device/getDeviceNames`,
    {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      data: body,
      ...(options || {}),
    },
  );
}

/** 修改基础Device PUT /device/updateDevice */
export async function putDeviceUpdateDevice(body: API.Device, options?: { [key: string]: any }) {
  return request<API.Response & { msg?: string }>(`/api/v1/device/updateDevice`, {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 关闭rtsp摄像头驱动 POST /device/closeRtspCamera */
export async function postDeviceCloseRtspCamera(
    body: API.KillRtspReq,
    options?: { [key: string]: any },
) {
    return request<API.Response & { msg?: string }>(`/api/v1/device/closeRtspCamera`, {
        method: 'POST',
        headers: {
            'Content-Type': 'application/json',
        },
        data: body,
        ...(options || {}),
    });
}


/** 打开rtsp摄像头驱动 POST /device/openRtspCamera */
export async function postDeviceOpenRtspCamera(
    body: API.RtspReq,
    options?: { [key: string]: any },
) {
    return request<API.Response & { data?: API.RtspRes; msg?: string }>(
        `/api/v1/device/openRtspCamera`,
        {
            method: 'POST',
            headers: {
                'Content-Type': 'application/json',
            },
            data: body,
            ...(options || {}),
        },
    );
}

export async function postDeviceGetAllDeviceByGroup(
  body: API.GetById,
  options?: { [key: string]: any },
) {
  return request<API.Response & { data?: API.AllResult; msg?: string }>(
    `/api/v1/device/getAllDeviceByGroup`,
    {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      data: body,
      ...(options || {}),
    },
  );
}
