import request from '@/utils/request';
import type { Activity, ActivityListResponse, ActivitySearchParams } from '@/types/activity';

export const getActivities = (params?: ActivitySearchParams) => {
    return request.get<any, ActivityListResponse>('/activities', { params });
};

export const getActivityDetail = (id: number) => {
    return request.get<any, Activity>(`/activities/${id}`);
};

export const getCalendarActivities = (year: number, month: number) => {
    return request.get<any, Activity[]>('/activities/calendar', { params: { year, month } });
};

export const createActivity = (data: Partial<Activity>) => {
    return request.post<any, number>('/activities', data);
};

export const updateActivity = (id: number, data: Partial<Activity>) => {
    return request.put(`/activities/${id}`, data);
};

export const deleteActivity = (id: number) => {
    return request.delete(`/activities/${id}`);
};
