import { customerFetch, ResponseDataEntity } from '.';

type FetchFeedbackListParams = {
  pageNum: number;
  customerId: number;
  pageSize: number;
  lastId?: number;
};
type CustomerFeedbackDetailVo = {
  feedbackId: number;
  replayAt: string;
  replayContent: string;
};
export type FeedbackItem = {
  content: string;
  createDate: string;
  id: number;
  replayList: CustomerFeedbackDetailVo[];
};
export const fetchFeedbackList = (
  params: FetchFeedbackListParams,
): Promise<ResponseDataEntity<FeedbackItem[]>> =>
  customerFetch({
    url: '/dcxy/customerFeedback/customerFeedback',
    data: params,
  });

type AddFeedbackParams = {
  content: string;
  customerId: number; // 会员id
  deviceInfo?: string;
  state?: number;
};

export const addFeedback = (params: AddFeedbackParams) =>
  customerFetch({
    url: '/dcxy/customerFeedback/customerFeedback',
    method: 'POST',
    data: params,
  });
