import request from '@/utils/request';
import type { Review, ReviewListResponse, CreateReviewParams } from '@/types/review';

export const submitReview = (data: CreateReviewParams) => {
    return request.post<any, Review>('/reviews', data);
};

export const getActivityReviews = (activityId: number, params?: any) => {
    return request.get<any, ReviewListResponse>(`/reviews/activity/${activityId}`, { params });
};

export const getReviewsByActivity = (params: { activityId: number; current?: number; size?: number }) => {
    return request.get<any, ReviewListResponse>(`/reviews/activity/${params.activityId}`, {
        params: {
            current: params.current || 1,
            size: params.size || 10
        }
    });
};

export const getMyReviews = (params?: any) => {
    return request.get<any, ReviewListResponse>('/reviews/my', { params });
};
