package com.toshibabd.customermanagement.api;

import com.toshibabd.customermanagement.model.ApiResponse;
import com.toshibabd.customermanagement.model.Customer;

import java.util.List;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.DELETE;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Query;

public interface ApiService {

    // ** IMPORTANT ** CHANGE THIS TO YOUR HOSTED DOMAIN/SUBPATH
    String BASE_URL = "https://cmm.flowtechbd.com/";

    @GET("get_customers.php")
    Call<List<Customer>> getCustomers(@Query("query") String query);

    @POST("add_customer.php")
    Call<ApiResponse> addCustomer(@Body Customer customer);

    @PUT("update_customer.php")
    Call<ApiResponse> updateCustomer(@Body Customer customer);

    @FormUrlEncoded
    @POST("update_status.php")
    Call<ApiResponse> updateStatus(
            @Field("id") int id,
            @Field("is_sent") int isSent,
            @Field("sent_date") String sentDate
    );

    @DELETE("delete_customer.php")
    Call<ApiResponse> deleteCustomer(@Query("id") int id);

    // --------------------------------------------------------------------------
    // NEW ENDPOINT: Secure Bulk SMS Sending (Accepts IDs and Message)
    // --------------------------------------------------------------------------

    @FormUrlEncoded
    @POST("send_bulk_sms.php")
    Call<ApiResponse> sendBulkSms(
            @Field("customer_ids[]") List<Integer> customerIds,
            @Field("message") String message // <-- New field for message content
    );
}