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

type SerializableCourier = {
  id: bigint;
  code: string;
  name: string;
  address: string | null;
  phone: string | null;
  website: string | null;
  email: string | null;
  status: string;
  createdAt: Date;
  updatedAt: Date;
};

export function serializeCourier(courier: SerializableCourier): CourierRecord {
  return {
    id: courier.id.toString(),
    code: courier.code,
    name: courier.name,
    address: courier.address,
    phone: courier.phone,
    website: courier.website,
    email: courier.email,
    status: courier.status,
    created_at: courier.createdAt.toISOString(),
    updated_at: courier.updatedAt.toISOString()
  };
}

