import request from '@/utils/request';
import type { Registration, RegistrationListResponse } from '@/types/registration';

// Register for an activity
export const registerActivity = (activityId: number) => {
    return request.post<any, Registration>('/registrations', { activityId });
};

// Cancel registration
export const cancelRegistration = (id: number) => {
    return request.delete(`/registrations/${id}`);
};

// Get my registrations
export const getMyRegistrations = (params?: any) => {
    return request.get<any, RegistrationListResponse>('/registrations/my', { params });
};

// Download ticket PDF
export const downloadTicket = (id: number): Promise<Blob> => {
    return request.get(`/registrations/${id}/ticket`, {
        responseType: 'blob'
    });
};
