import axios from "../../../config/axios";
import { type BrandsResponseType, type CreateBrandType } from "../types/Types";

export const getBrands = async (page: number = 1, limit: number = 10): Promise<BrandsResponseType> => {
  const { data } = await axios.get(`/brand`, {
    params: { page, limit }
  });
  return data;
};

export const deleteBrand = async (id: string) => {
  const { data } = await axios.delete(`/admin/brand/${id}`);
  return data;
};

export const createBrand = async (params: CreateBrandType) => {
  const { data } = await axios.post(`/admin/brand`, params);
  return data;
};

export const updateBrand = async (params: { id: string, params: CreateBrandType }) => {
  const { data } = await axios.patch(`/admin/brand/${params.id}`, params.params);
  return data;
};