package com.example.petstoremobile.api;

import com.example.petstoremobile.dtos.BulkDeleteRequest;
import com.example.petstoremobile.dtos.PageResponse;
import com.example.petstoremobile.dtos.ProductSupplierDTO;
import retrofit2.Call;
import retrofit2.http.*;

// api calls for product-supplier relationships
public interface ProductSupplierApi {

    // Get all product-suppliers with filters
    @GET("api/v1/product-suppliers")
    Call<PageResponse<ProductSupplierDTO>> getAllProductSuppliers(
            @Query("page") int page,
            @Query("size") int size,
            @Query("q") String query,
            @Query("productId") Long productId,
            @Query("supplierId") Long supplierId,
            @Query("sort") String sort);

    // Get product-supplier by composite id
    @GET("api/v1/product-suppliers/{productId}/{supplierId}")
    Call<ProductSupplierDTO> getProductSupplierById(
            @Path("productId") Long productId,
            @Path("supplierId") Long supplierId);

    // Create product-supplier
    @POST("api/v1/product-suppliers")
    Call<ProductSupplierDTO> createProductSupplier(@Body ProductSupplierDTO dto);

    // Update product-supplier
    @PUT("api/v1/product-suppliers/{productId}/{supplierId}")
    Call<ProductSupplierDTO> updateProductSupplier(
            @Path("productId") Long productId,
            @Path("supplierId") Long supplierId,
            @Body ProductSupplierDTO dto);

    // Delete product-supplier
    @DELETE("api/v1/product-suppliers/{productId}/{supplierId}")
    Call<Void> deleteProductSupplier(
            @Path("productId") Long productId,
            @Path("supplierId") Long supplierId);

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