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

/**
 * 登录成功后获取用户信息（昵称、头像、权限集合和角色集合）
 */
export function getUserMessageList(type: string): AxiosPromise {
  return request({
    url: "/api/v1/sys/message/page",
    method: "post",
    data: {
      pageNo: 1,
      pageSize: 10,
      messageId: "10",
      type: type,
    },
  });
}

export function getUserMessageNoPageList(
  type: string,
  title: string
): AxiosPromise {
  return request({
    url: `/api/v1/sys/message/list`,
    method: "post",
    data: {
      type: type,
      title: title,
    },
  });
}

export function getFileShareNoPageList(
  fileName: string
): AxiosPromise {
  return request({
    url: `/api/v1/synFileShare/list`,
    method: "post",
    data: {
      fileName: fileName,
    },
  });
}

export function getUserMessagePage(type: string, title?: string): AxiosPromise {
  return request({
    url: "/api/v1/sys/message/user/page",
    method: "post",
    data: {
      pageNo: 1,
      pageSize: 10,
      messageId: "10",
      type: type,
      title: title,
    },
  });
}

// 获取消息详情
export function getMessageDetail(id: string): AxiosPromise {
  return request({
    url: `/api/v1/sys/message/get/${id}`,
    method: "get",
  });
}

// 发送消息
export function sendMessage(id: string): AxiosPromise {
  return request({
    url: "/api/v1/sys/message/send",
    method: "post",
    data: {
      id: id,
    },
  });
}
