import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ChannelQuery, ChannelVO, ChannelForm } from './types';

export function listChannel(query: ChannelQuery): AxiosPromise<ChannelVO[]> {
  return request({ url: '/edu/channel/list', method: 'get', params: query });
}

export function getChannel(id: number | string): AxiosPromise<ChannelVO> {
  return request({ url: '/edu/channel/' + id, method: 'get' });
}

export function addChannel(data: ChannelForm) {
  return request({ url: '/edu/channel', method: 'post', data });
}

export function updateChannel(data: ChannelForm) {
  return request({ url: '/edu/channel', method: 'put', data });
}

export function delChannel(ids: string | number | (string | number)[]) {
  return request({ url: '/edu/channel/' + ids, method: 'delete' });
}
