import { http } from '@/utils/http/axios';

export enum STATUS {
  handled = 1,
  unhandled = 2,
}

export interface Records {
  id: number;
  nickname: string;
  username: string;
  tenantId: number;
  mobile: string;
  problemDescription: string;
  problemImage: Array<File>;
  problemStatus: STATUS;
  processor: string | null;
  processorTenant: string | null;
  dealMethod: string | null;
  createdAt: string;
  updatedAt: string;
  isDeleted: number;
}

export interface ReturnType {
  records: Records[];
  pageNumber: number;
  pageSize: number;
  totalPage: number;
  totalRow: number;
}

export interface QueryFeedback {
  pageNumber: number;
  pageSize: number;
  problemDescription?: string;
  problemStatus: STATUS;
}

//查询问题反馈列表
export const getFeedbackList = (data: QueryFeedback) => {
  return http.request<ReturnType>({
    url: `/problemFeedback/getProblemPage`,
    method: 'post',
    data,
  });
};

export interface UpdateFeedbackType {
  id: number;
  problemStatus: STATUS;
  processor: string;
  dealMethod: string;
}

//更新问题反馈
export const updateFeedback = (data: UpdateFeedbackType) => {
  return http.request({
    url: `/problemFeedback/updateProblem`,
    method: 'post',
    data,
  });
};
