import request from '@/utils/request';
import { AxiosPromise } from 'axios';

/**
 * 平台公告查询对象
 */
export interface AnnouncementQuery {
  pageNum?: number;
  pageSize?: number;
  title?: string;
  status?: string;
}

/**
 * 平台公告视图对象
 */
export interface AnnouncementVO {
  id: number;
  title: string;
  content: string;
  status: string;
  createTime: string;
  updateTime?: string;
}

/**
 * 查询平台公告列表
 * PC端接口
 */
export function getAnnouncementList(query?: AnnouncementQuery): AxiosPromise<AnnouncementVO[]> {
  return request({
    url: '/pc/announcement/list',
    method: 'get',
    params: query
  });
}

/**
 * 查询平台公告详情
 * PC端接口
 */
export function getAnnouncementInfo(id: number | string): AxiosPromise<AnnouncementVO> {
  return request({
    url: `/pc/announcement/${id}`,
    method: 'get'
  });
}
