package com.example.petstoremobile.api;

import com.example.petstoremobile.dtos.BulkDeleteRequest;
import com.example.petstoremobile.dtos.PageResponse;
import com.example.petstoremobile.dtos.ServiceDTO;

import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.DELETE;
import retrofit2.http.GET;
import retrofit2.http.HTTP;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Path;
import retrofit2.http.Query;

//api calls to CRUD services
public interface ServiceApi {
    // Get all services
    @GET("api/v1/services")
    Call<PageResponse<ServiceDTO>> getAllServices(
            @Query("page") int page,
            @Query("size") int size,
            @Query("q") String query,
            @Query("sort") String sort
    );

    // Get service by id
    @GET("api/v1/services/{id}")
    Call<ServiceDTO> getServiceById(@Path("id") Long id);

    // Create service
    @POST("api/v1/services")
    Call<ServiceDTO> createService(@Body ServiceDTO service);

    // Update service
    @PUT("api/v1/services/{id}")
    Call<ServiceDTO> updateService(@Path("id") Long id, @Body ServiceDTO service);

    // Delete service
    @DELETE("api/v1/services/{id}")
    Call<Void> deleteService(@Path("id") Long id);

    // Bulk delete services
    @HTTP(method = "DELETE", path = "api/v1/services", hasBody = true)
    Call<Void> bulkDeleteServices(@Body BulkDeleteRequest request);
}
