// import { PrismaClient as Prisma } from "@prisma/client";
// import { PrismaClient as PrismaLegacy } from "@prisma/client-legacy"

// const prisma_legacy = new PrismaLegacy({});
// const prisma = new Prisma({});

// export const initSupervisor = async () => {
//     const list_of_employees = await prisma.employees.findMany();

//     for (const employee of list_of_employees) {
//         console.log('Start of supervisor checking for employee: ', employee.id);

//         //finds in old db employee supervisor's infos 
//         const old_employee = await prisma_legacy.employees.findFirst({
//             where: {
//                 company: employee.company_code,
//                 employee_number: (employee.external_payroll_id).toString(),
//             },
//         });
//         if (!old_employee) {
//             console.warn('Old DB employee not found : ', employee.id);
//             continue;
//         }
//         if (!old_employee.supervisor) {
//             console.warn('Old DB employee supervisor not found for employee:', old_employee.supervisor);
//             continue;
//         }
//         //trims and split the supervisor name
//         const supervisor_full_name = old_employee.supervisor.trim();
//         let supervisor_first_name = supervisor_full_name.split(/\s+/)[0];
//         let supervisor_last_name = supervisor_full_name.split(/\s+/)[1] || '';

//         if (supervisor_first_name === '[default]') {
//             await prisma.employees.update({
//                 where: { id: employee.id },
//                 data: { supervisor_id: null },
//             });
//             console.log('employee with [default] found: ', employee.id);
//             continue;
//         }

//         if (supervisor_first_name === '') {
//             console.warn('No supervisor name found for employee: ', employee.id)
//             continue;
//         }

//         //finds employee id of supervisors
//         const supervisor = await prisma.users.findFirst({
//             where: { first_name: supervisor_first_name, last_name: supervisor_last_name },
//             select: {
//                 employee: { select: { id: true } },
//             }
//         });
//         if (!supervisor) {
//             console.warn('No supervisor found: ', supervisor_first_name, '', supervisor_last_name)
//             continue;
//         }
//         if (!supervisor.employee) {
//             console.warn('No supervisor id found: ', supervisor_first_name, '', supervisor_last_name)
//             continue;
//         }
//         //updates the supervisor id
//         await prisma.employees.update({
//             where: { id: employee.id },
//             data: {
//                 supervisor_id: supervisor.employee.id,

//             }
//         });
//         await prisma.employees.update({
//             where: { id: supervisor.employee.id },
//             data: {
//                 is_supervisor: true,
//             }
//         })
//         console.log('supervisor id : ', supervisor.employee.id);
//         console.log('supervisor name : ', supervisor_first_name, '', supervisor_last_name);
//     }
// }