import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { MediaResourceVO, MediaResourceForm, MediaResourceQuery } from '@/api/system/physical/mediaResource/types';

/**
 * 查询通用媒体资源列表
 * @param query
 * @returns {*}
 */

export const listMediaResource = (query?: MediaResourceQuery): AxiosPromise<MediaResourceVO[]> => {
  return request({
    url: '/physical/mediaResource/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询通用媒体资源详细
 * @param id
 */
export const getMediaResource = (id: string | number): AxiosPromise<MediaResourceVO> => {
  return request({
    url: '/physical/mediaResource/' + id,
    method: 'get'
  });
};

/**
 * 新增通用媒体资源
 * @param data
 */
export const addMediaResource = (data: MediaResourceForm) => {
  return request({
    url: '/physical/mediaResource',
    method: 'post',
    data: data
  });
};

/**
 * 修改通用媒体资源
 * @param data
 */
export const updateMediaResource = (data: MediaResourceForm) => {
  return request({
    url: '/physical/mediaResource',
    method: 'put',
    data: data
  });
};

/**
 * 删除通用媒体资源
 * @param id
 */
export const delMediaResource = (id: string | number | Array<string | number>) => {
  return request({
    url: '/physical/mediaResource/' + id,
    method: 'delete'
  });
};
