import baseApi from "./baseApi";

const termsAndPrivacyApi = baseApi.injectEndpoints({
    endpoints: (builder) => ({
        getTermsAndPrivacy: builder.query({
            query: (type) => ({
                url: `/terms-and-privacy/${type}`,
                method: "GET",
            }),
            providesTags: ["termsAndPrivacy"],
        }),
        createTermsAndPrivacy: builder.mutation({
            query: (data) => ({
                url: "/terms-and-privacy/create",
                method: "POST",
                body: data,
            }),
            invalidatesTags: ["termsAndPrivacy"],
        }),
    }),
});

export const {
    useGetTermsAndPrivacyQuery,
    useCreateTermsAndPrivacyMutation,
} = termsAndPrivacyApi;
