import baseApi from "./baseApi";

const serviceApi = baseApi.injectEndpoints({
    endpoints: (builder) => ({
        getAllServices: builder.query({
            query: () => ({
                url: '/service/all',
                method: 'GET',
            }),
            providesTags: ['services'],
        }),
        getSingleService: builder.query({
            query: (id) => ({
                url: `/service/single/${id}`,
                method: 'GET',
            }),
            providesTags: (result, error, id) => [{ type: 'services', id }],
        }),
    }),
});

export const { useGetAllServicesQuery, useGetSingleServiceQuery } = serviceApi;
export default serviceApi;
