package com.yono.messeripos.api.service;

import com.yono.messeripos.api.ApiHelper;
import com.yono.messeripos.models.CategoryModels;
import com.yono.messeripos.models.ProductModels;
import com.yono.messeripos.response.DataResponse;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.DELETE;
import retrofit2.http.Field;
import retrofit2.http.GET;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Part;
import retrofit2.http.Path;
import retrofit2.http.QueryMap;

public interface ProductService {
    @GET(ApiHelper.VERSI_API_1+"products")
    Call<DataResponse<List<ProductModels<CategoryModels>>>> getProducts();

    @DELETE(ApiHelper.VERSI_API_1+"product/{id}")
    Call<DataResponse<ProductModels>> deleteProducts(@Path("id") int id);


    @POST(ApiHelper.VERSI_API_1+"product")
    Call<DataResponse<ProductModels>> postProduct(@Body ProductModels productModels);

    @PUT(ApiHelper.VERSI_API_1+"product/{id}")
    Call<DataResponse<ProductModels>> updateProduct(@Body ProductModels productModels, @Path("id") int id);

    @Multipart
    @POST(ApiHelper.VERSI_API_1+"product")
    Call<DataResponse<ProductModels>> postProducts(
            @Part MultipartBody.Part image,
            @Part("name") RequestBody name,
            @Part("price") Integer price,
            @Part("stock") Integer stock,
            @Part("category_id") int category_id
    );

    @POST("https://ws-dev.oktapos.com/ws/synitem")
    Call<ResponseBody> syncData();
}
