import { defHttp } from '/@/utils/http/axios';
import {
  PageParams,
  ListGetResultModel,
  NoticeParams,
  UnreadModel,
  DelNoticeParams,
} from './model';
import { Result } from '/#/axios';

enum Api {
  pageList = '/zfb-api/zfb/platform/notice/list',
  addNotice = '/zfb-api/zfb/platform/notice/save',
  delNotice = '/zfb-api/zfb/platform/notice/delete',
  unreadNoticesList = '/zfb-api/zfb/platform/notice/unreadNoticesList',
  readAll = '/zfb-api/zfb/platform/notice/readAll',
}

/**
 * @description: Get sample list value
 */

export const listApi = (params: PageParams) =>
  defHttp.post<ListGetResultModel>({
    url: Api.pageList,
    params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });

export const addNoticeApi = (params: NoticeParams) =>
  defHttp.post<Result>({
    url: Api.addNotice,
    params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });

export const editNoticeApi = (params: NoticeParams) =>
  defHttp.post<Result>({
    url: Api.addNotice,
    params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });

export const deleteNoticeApi = (params: DelNoticeParams) =>
  defHttp.post<Result>({
    url: Api.delNotice,
    params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });

export const unreadNoticeApi = () =>
  defHttp.post<UnreadModel>({
    url: Api.unreadNoticesList,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });
export const readAllApi = () =>
  defHttp.post<Result>({
    url: Api.readAll,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });
