import request from '../utils/request';

export interface Review {
  id: number;
  orderId: number;
  userId: number;
  merchantId: number;
  roomId: number;
  rating: number;
  content?: string;
  images?: string[];
  isAnonymous: boolean;
  auditStatus: 'pending' | 'approved' | 'rejected';
  createdAt: string;
  order?: {
    id: number;
    orderNo: string;
  };
  room?: {
    id: number;
    title: string;
  };
  user?: {
    id: number;
    nickname?: string;
    avatar?: string;
  };
}

export interface ReviewListParams {
  page?: number;
  pageSize?: number;
  roomId?: number;
}

export interface ReviewListResponse {
  list: Review[];
  total: number;
  page: number;
  pageSize: number;
}

export function getReviews(params: ReviewListParams): Promise<ReviewListResponse> {
  return request.get('/api/merchant/reviews', { params });
}
