import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DesignPagePointVO, DesignPagePointForm, DesignPagePointQuery } from '@/api/system/designPagePoint/types';

/**
 * 查询大屏设计页面节点列表
 * @param query
 * @returns {*}
 */

export const listDesignPagePoint = (query?: DesignPagePointQuery): AxiosPromise<DesignPagePointVO[]> => {
  return request({
    url: '/system/designPagePoint/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询大屏设计页面节点详细
 * @param pagePointId
 */
export const getDesignPagePoint = (pagePointId: string | number): AxiosPromise<DesignPagePointVO> => {
  return request({
    url: '/system/designPagePoint/' + pagePointId,
    method: 'get'
  });
};

/**
 * 新增大屏设计页面节点
 * @param data
 */
export const addDesignPagePoint = (data: DesignPagePointForm) => {
  return request({
    url: '/system/designPagePoint',
    method: 'post',
    data: data
  });
};

/**
 * 修改大屏设计页面节点
 * @param data
 */
export const updateDesignPagePoint = (data: DesignPagePointForm) => {
  return request({
    url: '/system/designPagePoint',
    method: 'put',
    data: data
  });
};

/**
 * 删除大屏设计页面节点
 * @param pagePointId
 */
export const delDesignPagePoint = (pagePointId: string | number | Array<string | number>) => {
  return request({
    url: '/system/designPagePoint/' + pagePointId,
    method: 'delete'
  });
};


/**
 * 下拉框查询大屏设计页面节点列表
 * @param query
 * @returns {*}
 */
export function getSysDesignPagePointList (query) {
    return request({
        url: '/system/designPagePoint/getSysDesignPagePointList',
        method: 'get',
        params: query
    });
};
