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

type SerializableUnit = {
  id: bigint;
  code: string;
  name: string;
  createdAt: Date;
  updatedAt: Date;
};

export function serializeUnit(unit: SerializableUnit): UnitRecord {
  return {
    id: unit.id.toString(),
    code: unit.code,
    name: unit.name,
    created_at: unit.createdAt.toISOString(),
    updated_at: unit.updatedAt.toISOString()
  };
}
