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

type SerializableEmployee = {
  id: bigint;
  code: string;
  name: string;
  email: string | null;
  mobile: string | null;
  position: string;
  address: string | null;
  status: string;
  createdAt: Date;
  updatedAt: Date;
};

export function serializeEmployee(employee: SerializableEmployee): EmployeeRecord {
  return {
    id: employee.id.toString(),
    code: employee.code,
    name: employee.name,
    email: employee.email,
    mobile: employee.mobile,
    position: employee.position,
    address: employee.address,
    status: employee.status,
    created_at: employee.createdAt.toISOString(),
    updated_at: employee.updatedAt.toISOString()
  };
}

