import axios from "../../../config/axios";
import type {
  GetWarrantiesParams,
  WarrantyResponse,
  CreateWarrantyType,
} from "../types/Types";

export const getWarranties = async (
  params?: GetWarrantiesParams
): Promise<WarrantyResponse> => {
  const { data } = await axios.get("/warranty", { params });
  return data;
};

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

export const createWarranty = async (params: CreateWarrantyType) => {
  const { data } = await axios.post(`/admin/warranty`, params);
  return data;
};
