import request from "../../http/request";

export const interactionBaseApi = "/interactions";
/**
 * 帖子列表
 * @param params {circleId: number, page?: number, pageSize?: number}
 * @returns
 */
export const circlePostListApi = (params) => {
  return request({
    url: `/posts/circle/${params.circleId}`,
    method: "POST",
    data: {
      page: params.page || 1,
      limit: params.pageSize || 10,
    },
  });
};

/**
 * 举报
 * @param params {target_type: string,target_id: number,report_type: string,reason: string}
 * @returns
 */
export const reportApi = (params) => {
  return request({
    url: `/reports/create`,
    method: "POST",
    data: params,
  });
};

/**
 * 帖子详情
 * @param params {id: number}
 * @returns
 */
export const postDetailApi = (params) => {
  return request({
    url: `/posts/info/${params.id}`,
    method: "POST",
  });
};

/**
 * 新增帖子
 */
export const createPostApi = (params) => {
  return request({
    url: `/posts/create`,
    method: "POST",
    data: params,
  });
};

/**
 * 根据用户ID获取帖子列表
 */

export const getUserPostListApi = (userId?: any, params?: any) => {
  return request({
    url: userId ? `/posts/user/${userId}` : `/posts/user/`,
    method: "POST",
    data: params,
  });
};
