import { CONFIRM_OTP_URL, LOGIN_URL, SEND_OTP_URL } from "utils/constants";
import { LoginUserType } from "utils/types/appTypes";
import { baseApi } from "./apiSlice";

export const loginApi = baseApi.injectEndpoints({
  endpoints: (builder) => ({
    createLogin: builder.mutation({
      query: (body: LoginUserType) => ({
        url: LOGIN_URL,
        method: "POST",
        body,
      }),
    }),
    sendOtp: builder.mutation({
      query: (body: any) => ({
        url: SEND_OTP_URL,
        method: "POST",
        body,
      }),
    }),
    confirmOtp: builder.mutation({
      query: (body: any) => ({
        url: CONFIRM_OTP_URL,
        method: "POST",
        body,
      }),
    }),
  }),
});
export const {
  useCreateLoginMutation,
  useSendOtpMutation,
  useConfirmOtpMutation,
} = loginApi;
