import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { EventMdVO, EventMdForm } from '@/api/system/eventMd/types';

/**
 * 查询移动端富文本详细
 * @param id
 */
export const getEventMd = (id: string | number): AxiosPromise<EventMdVO> => {
  return request({
    url: '/system/markdown/' + id,
    method: 'get'
  });
};

/**
 * 根据赛事id和类型获取移动端富文本详细信息
 * @param id
 */
export const getEventMdByEventAndType = (eventId: string | number, type: number): AxiosPromise<EventMdVO> => {
  return request({
    url: `/system/markdown/${eventId}/${type}`,
    method: 'get'
  });
};

/**
 * 编辑移动端富文本
 * @param data
 */
export const editEventMd = (data: EventMdForm) => {
  return request({
    url: '/system/markdown',
    method: 'post',
    data: data
  });
};

/**
 * 删除移动端富文本
 * @param id
 */
export const delEventMd = (eventId: string | number, type: number) => {
  return request({
    url: `/system/markdown/${eventId}/${type}`,
    method: 'delete'
  });
};
