package com.example.petstoremobile.api;

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

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 suppliers
public interface SupplierApi {
    // Get all suppliers
    @GET("api/v1/suppliers")
    Call<PageResponse<SupplierDTO>> getAllSuppliers(
            @Query("page") int page,
            @Query("size") int size,
            @Query("q") String query,
            @Query("sort") String sort
    );

    // Get supplier by id
    @GET("api/v1/suppliers/{id}")
    Call<SupplierDTO> getSupplierById(@Path("id") Long id);

    // Create supplier
    @POST("api/v1/suppliers")
    Call<SupplierDTO> createSupplier(@Body SupplierDTO supplier);

    // Update supplier
    @PUT("api/v1/suppliers/{id}")
    Call<SupplierDTO> updateSupplier(@Path("id") Long id, @Body SupplierDTO supplier);

    // Delete supplier
    @DELETE("api/v1/suppliers/{id}")
    Call<Void> deleteSupplier(@Path("id") Long id);

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