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

type SerializableAdjustmentReason = {
  id: bigint;
  code: string;
  name: string;
  description: string | null;
  category: AdjustmentReasonRecord["category"];
  status: string;
  createdAt: Date;
  updatedAt: Date;
};

export function serializeAdjustmentReason(
  reason: SerializableAdjustmentReason
): AdjustmentReasonRecord {
  return {
    id: reason.id.toString(),
    code: reason.code,
    name: reason.name,
    description: reason.description,
    category: reason.category,
    status: reason.status,
    created_at: reason.createdAt.toISOString(),
    updated_at: reason.updatedAt.toISOString()
  };
}
