import type { WarehouseRecord } from "@/types/master-data";

type SerializableWarehouse = {
  id: bigint;
  code: string;
  name: string;
  address: string | null;
  status: string;
  createdAt: Date;
  updatedAt: Date;
};

export function serializeWarehouse(warehouse: SerializableWarehouse): WarehouseRecord {
  return {
    id: warehouse.id.toString(),
    code: warehouse.code,
    name: warehouse.name,
    address: warehouse.address,
    status: warehouse.status,
    created_at: warehouse.createdAt.toISOString(),
    updated_at: warehouse.updatedAt.toISOString()
  };
}
