"use client";

import {
  findAllLogisticsAction,
  saveLogisticAction,
  saveLogisticsBatchCreateAction,
  deleteLogisticAction,
  type LogisticRow,
  type SaveLogisticRequest,
} from "./actions";

export type { LogisticRow, SaveLogisticRequest };

export const findAllLogisticsClient = async (): Promise<LogisticRow[]> => {
  return await findAllLogisticsAction();
};

export const saveLogisticsBatchCreateClient = async (
  items: Omit<SaveLogisticRequest, "id">[],
): Promise<LogisticRow[]> => {
  return await saveLogisticsBatchCreateAction(items);
};

export const saveLogisticClient = async (
  data: SaveLogisticRequest,
): Promise<LogisticRow> => {
  return await saveLogisticAction(data);
};

export const deleteLogisticClient = async (id: number): Promise<void> => {
  await deleteLogisticAction({ id });
};
