import { DepartmentMemberDTO } from '../../../../departments/presentation/dataTransferObjects/departmentMemberDTO';
import { UserDAO } from '../../../../users/infrastructure/dataAccessObjects/userDAO';
import { KioskUserDTO } from '../../../presentation/dtos/kioskUserDTO';
import { TimeTrackingKioskUser } from '../../models/timeTracking/timeTrackingKioskUser';

export const mapKioskUser = (userDAO: UserDAO, kioskUser: TimeTrackingKioskUser): KioskUserDTO => {
    const department: DepartmentMemberDTO | null = userDAO.department?.department
        ? {
              id: userDAO.department.department.id,
              name: userDAO.department.department.name,
          }
        : null;

    return new KioskUserDTO(
        userDAO.id,
        userDAO.employeeInternalId,
        userDAO.firstName,
        userDAO.lastName,
        userDAO.email,
        department,
        kioskUser.updatedAt,
        kioskUser.deleted,
    );
};
