import axios from "../../../config/axios";
import type { ShipmentResponse, CreateShipper, Shipper } from "../types/Types";

export const getShipment = async (
  page: number = 1
): Promise<ShipmentResponse> => {
  const { data } = await axios.get<ShipmentResponse>(`/shipment?page=${page}`);
  return data;
};

export const createShipment = async (data: CreateShipper): Promise<Shipper> => {
  const response = await axios.post<Shipper>("/admin/shipment", data);
  return response.data;
};

export const deleteShipment = async (id: string): Promise<void> => {
  const { data } = await axios.delete(`/admin/shipment/${id}`);
  return data;
};
