package com.taf.attendance.data import com.google.gson.annotations.SerializedName import com.taf.attendance.model.AttendanceRecord import com.taf.attendance.model.LeaveRequest import com.taf.attendance.model.LeaveBalance import com.taf.attendance.model.LeaveType import okhttp3.MultipartBody import okhttp3.RequestBody import retrofit2.http.Body import retrofit2.http.GET import retrofit2.http.Multipart import retrofit2.http.POST import retrofit2.http.Part import retrofit2.http.Query interface ApiService { @POST("users/login") suspend fun login(@Body creds: Map): LoginResponse @POST("timeclocks") suspend fun logTime(@Body data: ClockPayload): ApiStatus @GET("timeclocks/recent") suspend fun recentClocks(@Query("days") days: Int = 30): List @GET("timeclocks/last-entry") suspend fun getLastEntry(): TimeClockDto? @GET("salary/payslips") suspend fun myPayslips(): List @GET("salary/payslips/html/{id}") suspend fun payslipHtml(@retrofit2.http.Path("id") id: String): okhttp3.ResponseBody @Multipart @POST("users/{id}/face") suspend fun uploadFace( @retrofit2.http.Path("id") userId: String, // Changed to String @Part image: MultipartBody.Part, @Part("embedding") embedding: RequestBody ): ApiStatus @GET("users/{id}/face") suspend fun getFace(@retrofit2.http.Path("id") userId: String): FaceDto // Changed to String @Multipart @POST("timeclocks/face-debug") suspend fun reportFaceFailure( @Part image: MultipartBody.Part, @Part reference: MultipartBody.Part, @Part("user_id") userId: RequestBody ): ApiStatus @GET("sync") suspend fun getLeaveRequests(@Query("table") table: String = "leave_requests"): List @GET("sync") suspend fun getLeaveBalances(@Query("table") table: String = "leave_balances"): List @GET("sync") suspend fun getLeaveTypes(@Query("table") table: String = "leave_types"): List @POST("sync") suspend fun submitLeaveRequest(@Body request: LeaveRequestPayload): ApiStatus } data class LeaveRequestPayload( val table: String = "leave_requests", val data: LeaveRequest ) data class LocationDto( val lat: Double, val lng: Double, val radius: Int? ) data class BranchDto( val branch_id: String, val name: String, val latitude: Double?, val longitude: Double? ) data class UserDto( @SerializedName("user_id") val id: String ) data class LoginResponse( val token: String, val branches: List?, val user: UserDto ) data class ApiStatus(val status: String) data class TimeClockDto( val clock_type: String, val clocked_at: String, val lat: Double?, val lng: Double? ) data class PayslipDto( val id: String, // Changed from Int to String for UUID val run_date: String?, val gross_pay: Double, val net_pay: Double, val user_id: String, val org_id: String, val time_clock_aggregate_id: String, val user_name: String?, val org_name: String?, val start_date: String?, val end_date: String?, val deductions: List ) data class DeductionDto( val name: String, val amount: Double ) data class FaceDto( val embedding: String, val image: String )