import { useMutation, useQuery } from "@tanstack/react-query";
import * as api from "../service/BrandService";

export const useGetBrands = (page: number = 1, limit: number = 10) => {
  return useQuery({
    queryKey: ["brands", page, limit],
    queryFn: () => api.getBrands(page, limit),
  });
};

export const useDeleteBrand = () => {
  return useMutation({
    mutationFn: (id: string) => api.deleteBrand(id),
  });
};

export const useCreateBrand = () => {
  return useMutation({
    mutationFn: api.createBrand,
  });
};

export const useUpdateBrand = () => {
  return useMutation({
    mutationFn: api.updateBrand,
  });
};
