import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DesignPageConfigVO, DesignPageConfigForm, DesignPageConfigQuery } from '@/api/system/designPageConfig/types';

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

export const listDesignPageConfig = (query?: DesignPageConfigQuery): AxiosPromise<DesignPageConfigVO[]> => {
  return request({
    url: '/system/designPageConfig/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询大屏设计页面配置详细
 * @param pageConfigId
 */
export const getDesignPageConfig = (pageConfigId: string | number): AxiosPromise<DesignPageConfigVO> => {
  return request({
    url: '/system/designPageConfig/' + pageConfigId,
    method: 'get'
  });
};

/**
 * 新增大屏设计页面配置
 * @param data
 */
export const addDesignPageConfig = (data: DesignPageConfigForm) => {
  return request({
    url: '/system/designPageConfig',
    method: 'post',
    data: data
  });
};

/**
 * 修改大屏设计页面配置
 * @param data
 */
export const updateDesignPageConfig = (data: DesignPageConfigForm) => {
  return request({
    url: '/system/designPageConfig',
    method: 'put',
    data: data
  });
};

/**
 * 删除大屏设计页面配置
 * @param pageConfigId
 */
export const delDesignPageConfig = (pageConfigId: string | number | Array<string | number>) => {
  return request({
    url: '/system/designPageConfig/' + pageConfigId,
    method: 'delete'
  });
};


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