import { apiSlice } from "../..";

// Backend endpoint: POST /location/place-id/
// Body: { placeId: string }

export interface LocationPlaceIdRequest {
  placeId: string;
}

export interface LocationPlaceIdResponse {
  // Shape is backend-defined; keep generic for now.
  code?: number;
  message?: string;
  success?: boolean;
  data?: any;
}

export const placeApi = apiSlice.injectEndpoints({
  endpoints: (builder) => ({
    sendPlaceId: builder.mutation<
      LocationPlaceIdResponse,
      LocationPlaceIdRequest
    >({
      query: (body) => ({
        url: "/location/place-id",
        method: "POST",
        body,
      }),
    }),
  }),
  overrideExisting: false,
});

export const { useSendPlaceIdMutation } = placeApi;
