import type { ChangePasswordRequest, CurrentUserResponse, EmailRequest, NotificationListResponse, OkResponse, OtpRequestResponse, PasswordLoginRequest, RegisterCitizenRequest, RegisterCitizenResponse, RewardsResponse, TokenResponse, VerifyOtpRequest } from "~/types/api"; export const useAuth = () => { const register = (body: RegisterCitizenRequest) => useApiFetch('/api/v1/auth/register', { method: 'POST', body }) const requestOtp = (body: EmailRequest) => useApiFetch('/api/v1/auth/otp/request', { method: 'POST', body }) const verifyOtp = (body: VerifyOtpRequest) => useApiFetch('/api/v1/auth/otp/verify', { method: 'POST', body }) const loginWithPassword = (body: PasswordLoginRequest) => useApiFetch('/api/v1/auth/login/password', { method: 'POST', body }) const changePassword = (body: ChangePasswordRequest) => useApiFetch('/api/v1/auth/change-password', { method: 'POST', body }) const fetchCurrentUser = () => useApiFetch('/api/v1/me', { method: 'GET' }) const fetchRewards = (query?: { page?: number; per_page?: number }) => useApiFetch('/api/v1/me/rewards', { method: 'GET', query }) const fetchNotifications = (query?: { page?: number; per_page?: number }) => useApiFetch('/api/v1/notifications', { method: 'GET', query }) const markNotificationRead = (id: number) => useApiFetch(`/api/v1/notifications/${id}/read`, { method: 'PATCH' }) return { register, requestOtp, verifyOtp, loginWithPassword, changePassword, fetchCurrentUser, fetchRewards, fetchNotifications, markNotificationRead, } }