Add standardized documentation headers

This commit is contained in:
Avinash Rajesh
2026-05-22 13:26:02 +05:30
parent 826919579c
commit 34cb64ab1b
18 changed files with 544 additions and 1 deletions
@@ -182,6 +182,7 @@
<ClInclude Include="utilities\Vector.h" />
<ClInclude Include="views\AdminMenu.h" />
<ClInclude Include="views\CustomerMenu.h" />
<ClInclude Include="views\MenuHelper.h" />
<ClInclude Include="views\TechnicianMenu.h" />
<ClInclude Include="views\UserInterface.h" />
</ItemGroup>
@@ -1,28 +1,71 @@
/*
File: Controller.cpp
Description: Implementation file containing the method definitions of the
Controller class, including authentication, user creation,
service purchasing, and system checks.
Author: Trenser
Date:19-May-2026
*/
#include <stdexcept>
#include "Controller.h"
#include "Enums.h"
#include "User.h"
/*
Function: login
Description: Authenticates a user by delegating to the authentication management service.
Parameter: const std::string& username - users username
const std::string& password - users password
Return type: bool - true if login successful, false otherwise
*/
bool Controller::login(const std::string& username, const std::string& password)
{
return m_authenticationManagementService.login(username, password);
}
/*
Function: logout
Description: Logs out the currently authenticated user.
Parameter: None
Return type: void
*/
void Controller::logout()
{
m_authenticationManagementService.logout();
}
/*
Function: changePassword
Description: Changes the password of the currently authenticated user.
Parameter: const std::string& newPassword - new password to set
Return type: void
*/
void Controller::changePassword(const std::string& newPassword)
{
m_authenticationManagementService.changePassword(newPassword);
}
/*
Function: createCustomer
Description: Creates a new customer account with the provided details.
Parameter: const std::string& username - customers username
const std::string& name - customers name
const std::string& password - customers password
const std::string& email - customers email
const std::string& phone - customers phone number
Return type: void
*/
void Controller::createCustomer(const std::string& username, const std::string& name, const std::string& password, const std::string& email, const std::string& phone)
{
m_userManagementService.createUser(username, name, password, email, phone, util::UserType::CUSTOMER);
}
/*
Function: getAuthenticatedUser
Description: Retrieves the currently authenticated user.
Parameter: None
Return type: const User* - pointer to the authenticated user
*/
const User* Controller::getAuthenticatedUser()
{
return m_authenticationManagementService.getAuthenticatedUser();
@@ -32,6 +75,13 @@ void Controller::createTechnician(const std::string& username, const std::string
{
}
/*
Function: updateUserDetails
Description: Updates the email and phone details of the currently authenticated user.
Parameter: const std::string& email - new email address
const std::string& phone - new phone number
Return type: void
*/
void Controller::updateUserDetails(const std::string& email, const std::string& phone)
{
User* authenticatedUser = m_authenticationManagementService.getAuthenticatedUser();
@@ -52,11 +102,29 @@ util::Map<std::string, const ComboPackage*> Controller::getComboPackages()
return util::Map<std::string, const ComboPackage*>();
}
/*
Function: purchaseService
Description: Purchases one or more services for a vehicle by delegating to the service management service.
Parameter: const util::Vector<std::string>& serviceIDs - IDs of services to purchase
const std::string& vehicleNumber - vehicle registration number
const std::string& vehicleBrand - brand of the vehicle
const std::string& vehicleModel - model of the vehicle
Return type: void
*/
void Controller::purchaseService(const util::Vector<std::string>& serviceIDs, const std::string& vehicleNumber, const std::string& vehicleBrand, const std::string& vehicleModel)
{
m_serviceManagementService.purchaseService(serviceIDs, vehicleNumber, vehicleBrand, vehicleModel);
}
/*
Function: purchaseComboPackage
Description: Purchases a combo package for a vehicle by delegating to the service management service.
Parameter: const std::string& comboPackageID - ID of the combo package
const std::string& vehicleNumber - vehicle registration number
const std::string& vehicleBrand - brand of the vehicle
const std::string& vehicleModel - model of the vehicle
Return type: void
*/
void Controller::purchaseComboPackage(const std::string& comboPackageID, const std::string& vehicleNumber, const std::string& vehicleBrand, const std::string& vehicleModel)
{
m_serviceManagementService.purchaseComboPackage(comboPackageID, vehicleNumber, vehicleBrand, vehicleModel);
@@ -155,6 +223,12 @@ void Controller::configureNotifications(const std::string& userID, bool paymentN
{
}
/*
Function: runSystemChecks
Description: Runs system checks to ensure critical configurations, such as verifying admin existence.
Parameter: None
Return type: void
*/
void Controller::runSystemChecks()
{
m_userManagementService.ensureAdminExists();
@@ -1,3 +1,11 @@
/*
File: Controller.h
Description: Header file declaring the Controller class, which coordinates
authentication, user management, service management, inventory,
and notifications across the Vehicle Service System.
Author: Trenser
Date:19-May-2026
*/
#pragma once
#include "Map.h"
#include <string>
@@ -1,13 +1,42 @@
/*
File: ServiceBooking.cpp
Description: Implementation file containing the method definitions of the
ServiceBooking class, including constructors, getters, and setters
for booking attributes.
Author: Trenser
Date:19-May-2026
*/
#include "ServiceBooking.h"
int ServiceBooking::m_uid = 0;
/*
Function: ServiceBooking
Description: Default constructor that initializes a new service booking
with a unique ID, no customer or technician, and zero discount.
Parameter: None
Return type: Constructor
*/
ServiceBooking::ServiceBooking()
: m_id("SRV" + std::to_string(++m_uid)),
m_customer(nullptr),
m_assignedTechnician(nullptr),
m_discountPercentage(0.0) {}
/*
Function: ServiceBooking
Description: Parameterized constructor that initializes a service booking
with customer, vehicle, services, and discount details.
Parameter: util::ServiceJobStatus status - current booking status
const util::Map<std::string, Service*>& services - map of services
const std::string& customerId - ID of the customer
User* customer - pointer to the customer object
const std::string& vehicleNumber - vehicle registration number
const std::string& vehicleBrand - brand of the vehicle
const std::string& vehicleModel - model of the vehicle
double discountPercentage - discount applied to the booking
Return type: Constructor
*/
ServiceBooking::ServiceBooking(
util::ServiceJobStatus status,
const util::Map<std::string,
@@ -33,111 +62,242 @@ ServiceBooking::ServiceBooking(
{
}
/*
Function: getId
Description: Retrieves the unique identifier of the service booking.
Parameter: None
Return type: const std::string&
*/
const std::string& ServiceBooking::getId() const
{
return m_id;
}
/*
Function: getStatus
Description: Retrieves the current status of the service booking.
Parameter: None
Return type: util::ServiceJobStatus
*/
util::ServiceJobStatus ServiceBooking::getStatus() const
{
return m_status;
}
/*
Function: getServices
Description: Retrieves the services associated with the booking.
Parameter: None
Return type: const util::Map<std::string, Service*>&
*/
const util::Map<std::string, Service*>& ServiceBooking::getServices() const
{
return m_services;
}
/*
Function: getCustomerId
Description: Retrieves the customer ID associated with the booking.
Parameter: None
Return type: const std::string&
*/
const std::string& ServiceBooking::getCustomerId() const
{
return m_customerId;
}
/*
Function: getCustomer
Description: Retrieves the customer object associated with the booking.
Parameter: None
Return type: User*
*/
User* ServiceBooking::getCustomer() const
{
return m_customer;
}
/*
Function: getVehicleNumber
Description: Retrieves the vehicle registration number for the booking.
Parameter: None
Return type: const std::string&
*/
const std::string& ServiceBooking::getVehicleNumber() const
{
return m_vehicleNumber;
}
/*
Function: getVehicleBrand
Description: Retrieves the brand of the vehicle for the booking.
Parameter: None
Return type: const std::string&
*/
const std::string& ServiceBooking::getVehicleBrand() const
{
return m_vehicleBrand;
}
/*
Function: getVehicleModel
Description: Retrieves the model of the vehicle for the booking.
Parameter: None
Return type: const std::string&
*/
const std::string& ServiceBooking::getVehicleModel() const
{
return m_vehicleModel;
}
/*
Function: getAssignedTechnicianId
Description: Retrieves the ID of the technician assigned to the booking.
Parameter: None
Return type: const std::string&
*/
const std::string& ServiceBooking::getAssignedTechnicianId() const
{
return m_assignedTechnicianId;
}
/*
Function: getAssignedTechnician
Description: Retrieves the technician object assigned to the booking.
Parameter: None
Return type: User*
*/
User* ServiceBooking::getAssignedTechnician() const
{
return m_assignedTechnician;
}
/*
Function: getDiscountPercentage
Description: Retrieves the discount percentage applied to the booking.
Parameter: None
Return type: double
*/
double ServiceBooking::getDiscountPercentage() const
{
return m_discountPercentage;
}
/*
Function: setId
Description: Sets the unique identifier of the service booking.
Parameter: const std::string& id - new booking ID
Return type: void
*/
void ServiceBooking::setId(const std::string& id)
{
m_id = id;
}
/*
Function: setStatus
Description: Sets the current status of the service booking.
Parameter: const util::ServiceJobStatus& status - new booking status
Return type: void
*/
void ServiceBooking::setStatus(const util::ServiceJobStatus& status)
{
m_status = status;
}
/*
Function: setServices
Description: Sets the services associated with the booking.
Parameter: const util::Map<std::string, Service*>& services - new services map
Return type: void
*/
void ServiceBooking::setServices(const util::Map<std::string, Service*>& services)
{
m_services = services;
}
/*
Function: setCustomerId
Description: Sets the customer ID for the booking.
Parameter: const std::string& customerId - new customer ID
Return type: void
*/
void ServiceBooking::setCustomerId(const std::string& customerId)
{
m_customerId = customerId;
}
/*
Function: setCustomer
Description: Sets the customer object for the booking.
Parameter: User* customer - pointer to the customer object
Return type: void
*/
void ServiceBooking::setCustomer(User* customer)
{
m_customer = customer;
}
/*
Function: setVehicleNumber
Description: Sets the vehicle registration number for the booking.
Parameter: const std::string& vehicleNumber - new vehicle number
Return type: void
*/
void ServiceBooking::setVehicleNumber(const std::string& vehicleNumber)
{
m_vehicleNumber = vehicleNumber;
}
/*
Function: setVehicleBrand
Description: Sets the brand of the vehicle for the booking.
Parameter: const std::string& vehicleBrand - new vehicle brand
Return type: void
*/
void ServiceBooking::setVehicleBrand(const std::string& vehicleBrand)
{
m_vehicleBrand = vehicleBrand;
}
/*
Function: setVehicleModel
Description: Sets the model of the vehicle for the booking.
Parameter: const std::string& vehicleModel - new vehicle model
Return type: void
*/
void ServiceBooking::setVehicleModel(const std::string& vehicleModel)
{
m_vehicleModel = vehicleModel;
}
/*
Function: setAssignedTechnicianId
Description: Sets the ID of the technician assigned to the booking.
Parameter: const std::string& assignedTechnicianId - new technician ID
Return type: void
*/
void ServiceBooking::setAssignedTechnicianId(const std::string& assignedTechnicianId)
{
m_assignedTechnicianId = assignedTechnicianId;
}
/*
Function: setAssignedTechnician
Description: Sets the technician object assigned to the booking.
Parameter: User* assignedTechnician - pointer to the technician object
Return type: void
*/
void ServiceBooking::setAssignedTechnician(User* assignedTechnician)
{
m_assignedTechnician = assignedTechnician;
}
/*
Function: setDiscountPercentage
Description: Sets the discount percentage for the booking.
Parameter: double discountPercentage - new discount percentage
Return type: void
*/
void ServiceBooking::setDiscountPercentage(double discountPercentage)
{
m_discountPercentage = discountPercentage;
@@ -1,3 +1,11 @@
/*
File: ServiceBooking.h
Description: Header file declaring the ServiceBooking class, which represents
a booking of services by a customer, including vehicle details,
assigned technician, and discount information.
Author: Trenser
Date:19-May-2026
*/
#pragma once
#include <string>
#include "Map.h"
@@ -1,9 +1,26 @@
/*
File: AuthenticationManagementService.cpp
Description: Implementation file containing the method definitions of the
AuthenticationManagementService class, including login, logout,
password change, and retrieval of the authenticated user.
Author: Trenser
Date:19-May-2026
*/
#include <stdexcept>
#include "AuthenticationManagementService.h"
#include "User.h"
User* AuthenticationManagementService::m_authenticatedUser = nullptr;
/*
Function: login
Description: Authenticates a user by checking the provided username and password
against the stored users in the DataStore. If successful, sets the
authenticated user.
Parameter: const std::string& username - users username
const std::string& password - users password
Return type: bool - true if login successful, false otherwise
*/
bool AuthenticationManagementService::login(const std::string& username, const std::string& password)
{
util::Map<std::string, User*> users = m_dataStore.getUsers();
@@ -24,16 +41,36 @@ bool AuthenticationManagementService::login(const std::string& username, const s
return false;
}
/*
Function: getAuthenticatedUser
Description: Retrieves the currently authenticated user.
Parameter: None
Return type: User* - pointer to the authenticated user
*/
User* AuthenticationManagementService::getAuthenticatedUser()
{
return m_authenticatedUser;
}
/*
Function: logout
Description: Logs out the currently authenticated user by clearing the
static authenticated user pointer.
Parameter: None
Return type: void
*/
void AuthenticationManagementService::logout()
{
m_authenticatedUser = nullptr;
}
/*
Function: changePassword
Description: Changes the password of the currently authenticated user.
Throws an exception if no user is logged in.
Parameter: const std::string& newPassword - new password to set
Return type: void
*/
void AuthenticationManagementService::changePassword(const std::string& newPassword)
{
if (m_authenticatedUser == nullptr)
@@ -1,3 +1,11 @@
/*
File: AuthenticationManagementService.h
Description: Header file declaring the AuthenticationManagementService class, which manages
user authentication, login, logout, password changes, and retrieval of the
authenticated user.
Author: Trenser
Date:19-May-2026
*/
#pragma once
#include <string>
#include "DataStore.h"
@@ -1,3 +1,11 @@
/*
File: ServiceManagementService.cpp
Description: Implementation file containing the method definitions of the
ServiceManagementService class, including service and combo package
purchasing logic, booking creation, and notification handling.
Author: Trenser
Date:19-May-2026
*/
#include <stdexcept>
#include "ServiceManagementService.h"
#include "AuthenticationManagementService.h"
@@ -6,6 +14,17 @@
#include "ComboPackage.h"
#include "Factory.h"
/*
Function: purchaseService
Description: Creates a new service booking for the authenticated user. Validates
service IDs, retrieves services from the DataStore, and generates a
booking. Sends a notification upon successful booking.
Parameter: const util::Vector<std::string>& serviceIDs - IDs of services to purchase
const std::string& vehicleNumber - vehicle registration number
const std::string& vehicleBrand - brand of the vehicle
const std::string& vehicleModel - model of the vehicle
Return type: void
*/
void ServiceManagementService::purchaseService(const util::Vector<std::string>& serviceIDs, const std::string& vehicleNumber, const std::string& vehicleBrand, const std::string& vehicleModel)
{
AuthenticationManagementService m_authenticationManagementService;
@@ -39,6 +58,17 @@ void ServiceManagementService::purchaseService(const util::Vector<std::string>&
"Your service booking has been successfully placed with ID " + serviceBooking->getId());
}
/*
Function: purchaseComboPackage
Description: Creates a new service booking for a combo package. Validates the combo
package ID, retrieves services from the package, and generates a booking
with the applicable discount. Sends a notification upon successful booking.
Parameter: const std::string& comboPackageID - ID of the combo package
const std::string& vehicleNumber - vehicle registration number
const std::string& vehicleBrand - brand of the vehicle
const std::string& vehicleModel - model of the vehicle
Return type: void
*/
void ServiceManagementService::purchaseComboPackage(const std::string& comboPackageID, const std::string& vehicleNumber, const std::string& vehicleBrand, const std::string& vehicleModel)
{
AuthenticationManagementService m_authenticationManagementService;
@@ -1,3 +1,11 @@
/*
File: ServiceManagementService.h
Description: Header file declaring the ServiceManagementService class, which manages
services, combo packages, job cards, and service bookings. Inherits from
NotificationManagementService to handle notifications.
Author: Trenser
Date:19-May-2026
*/
#pragma once
#include <string>
#include "Map.h"
@@ -1,3 +1,11 @@
/*
File: UserManagementService.cpp
Description: Implementation file containing the method definitions of the
UserManagementService class, including user creation, updates,
and ensuring an admin account exists.
Author: Trenser
Date:19-May-2026
*/
#include <stdexcept>
#include "User.h"
#include "Enums.h"
@@ -8,6 +16,14 @@
#include "InventoryManagementService.h"
#include "Factory.h"
/*
Function: ensureAdminExists
Description: Ensures that at least one admin user exists in the system.
If no admin is found, creates a default admin user using
configuration constants.
Parameter: None
Return type: void
*/
void UserManagementService::ensureAdminExists()
{
auto& usersMap = m_dataStore.getUsers();
@@ -34,6 +50,19 @@ void UserManagementService::ensureAdminExists()
}
}
/*
Function: createUser
Description: Creates a new user with the provided details. Validates that
the username is unique, then attaches the user to relevant
management services (payment, service, inventory).
Parameter: const std::string& username - users username
const std::string& name - users name
const std::string& password - users password
const std::string& email - users email address
const std::string& phone - users phone number
util::UserType type - type of user (ADMIN, CUSTOMER, TECHNICIAN)
Return type: void
*/
void UserManagementService::createUser(const std::string& username, const std::string& name, const std::string& password, const std::string& email, const std::string& phone, util::UserType type)
{
InventoryManagementService inventoryManagementService;
@@ -60,6 +89,15 @@ void UserManagementService::createUser(const std::string& username, const std::s
}
}
/*
Function: updateUserDetails
Description: Updates the email and phone details of an existing user.
Throws an exception if the user does not exist.
Parameter: const std::string& userID - ID of the user to update
const std::string& email - new email address
const std::string& phone - new phone number
Return type: void
*/
void UserManagementService::updateUserDetails(const std::string& userID, const std::string& email, const std::string& phone)
{
auto& usersMap = m_dataStore.getUsers();
@@ -1,3 +1,11 @@
/*
File: UserManagementService.h
Description: Header file declaring the UserManagementService class, which manages
user creation, updates, retrieval, removal, notifications, and ensures
the existence of an admin account.
Author: Trenser
Date:19-May-2026
*/
#pragma once
#include <string>
#include "Map.h"
@@ -1,3 +1,11 @@
/*
File: Config.h
Description: Header file declaring configuration constants for the Vehicle Service System.
Includes default admin account details such as username, name, password,
email, and phone number.
Author: Trenser
Date:19-May-2026
*/
#pragma once
namespace config
@@ -1,7 +1,21 @@
/*
File: Utility.h
Description: Header file declaring utility functions used across the system,
including cost calculation for services and combo packages.
Author: Trenser
Date:19-May-2026
*/
#pragma once
#include "Service.h"
#include "InventoryItem.h"
/*
Function: calculatePartsCost
Description: Calculates the total cost of parts required for a given service
by summing the prices of all associated inventory items.
Parameter: const Service* service - pointer to the service object
Return type: double - total cost of required parts
*/
inline double calculatePartsCost(const Service* service)
{
double cost = 0;
@@ -14,6 +28,13 @@ inline double calculatePartsCost(const Service* service)
return cost;
}
/*
Function: calculateComboServiceEstimatedCost
Description: Calculates the estimated total cost of a combo package by summing
the labor and parts costs of all services included in the package.
Parameter: const ComboPackage* comboPackage - pointer to the combo package object
Return type: double - estimated total cost of the combo package
*/
inline double calculateComboServiceEstimatedCost(const ComboPackage* comboPackage)
{
double cost = 0;
@@ -1,3 +1,11 @@
/*
File: CustomerMenu.cpp
Description: Implementation file containing the method definitions of the
CustomerMenu class, including menu handling, service selection,
combo package booking, profile updates, and password management.
Author: Trenser
Date:19-May-2026
*/
#include <iomanip>
#include "CustomerMenu.h"
#include "Service.h"
@@ -11,6 +19,12 @@
#include "Utility.h"
#include "Map.h"
/*
Function: showMenu
Description: Displays the customer menu and handles user input until logout is selected.
Parameter: None
Return type: void
*/
void CustomerMenu::showMenu()
{
while (true)
@@ -45,6 +59,12 @@ void CustomerMenu::showMenu()
}
}
/*
Function: handleOperation
Description: Executes the corresponding customer operation based on the selected menu choice.
Parameter: int choice - selected menu option
Return type: bool - true if menu continues, false if logout
*/
bool CustomerMenu::handleOperation(int choice)
{
switch (choice)
@@ -86,11 +106,23 @@ bool CustomerMenu::handleOperation(int choice)
return true;
}
/*
Function: logout
Description: Logs out the currently authenticated customer user.
Parameter: None
Return type: void
*/
void CustomerMenu::logout()
{
m_controller.logout();
}
/*
Function: changePassword
Description: Allows the customer to change their password after validation.
Parameter: None
Return type: void
*/
void CustomerMenu::changePassword()
{
std::string newPassword;
@@ -108,6 +140,12 @@ void CustomerMenu::changePassword()
util::pressEnter();
}
/*
Function: updateDetails
Description: Allows the customer to update their email and phone number after validation.
Parameter: None
Return type: void
*/
void CustomerMenu::updateDetails()
{
std::string email, phone;
@@ -133,6 +171,12 @@ void CustomerMenu::updateDetails()
util::pressEnter();
}
/*
Function: selectServiceFromServices
Description: Displays active services and allows the customer to select one by index.
Parameter: const util::Map<std::string, const Service*>& services - list of services
Return type: const Service* - selected service
*/
static const Service* selectServiceFromServices(const util::Map<std::string, const Service*>& services)
{
util::Map<int, const Service*> activeServicesMap;
@@ -176,6 +220,13 @@ static const Service* selectServiceFromServices(const util::Map<std::string, con
return activeServicesMap[userInputIndex];
}
/*
Function: selectService
Description: Allows the customer to select a service, provide vehicle details,
and book the service through the controller.
Parameter: None
Return type: void
*/
void CustomerMenu::selectService()
{
std::string vehicleNumber, vehicleBrand, vehicleModel;
@@ -202,6 +253,12 @@ void CustomerMenu::selectService()
util::pressEnter();
}
/*
Function: selectComboPackageFromPackages
Description: Displays active combo packages and allows the customer to select one by index.
Parameter: const util::Map<std::string, const ComboPackage*>& comboPackages - list of combo packages
Return type: const ComboPackage* - selected combo package
*/
static const ComboPackage* selectComboPackageFromPackages(const util::Map<std::string, const ComboPackage*>& comboPackages)
{
util::Map<int, const ComboPackage*> activeComboPackages;
@@ -244,6 +301,13 @@ static const ComboPackage* selectComboPackageFromPackages(const util::Map<std::s
return activeComboPackages[userInputIndex];
}
/*
Function: selectComboPackage
Description: Allows the customer to select a combo package, provide vehicle details,
and book the package through the controller.
Parameter: None
Return type: void
*/
void CustomerMenu::selectComboPackage()
{
std::string vehicleNumber, vehicleBrand, vehicleModel;
@@ -1,3 +1,12 @@
/*
File: CustomerMenu.h
Description: Header file declaring the CustomerMenu class, which provides
customer operations such as selecting services, booking combo
packages, updating profile details, managing payments, viewing
invoices, and configuring notifications.
Author: Trenser
Date:19-May-2026
*/
#pragma once
#include "Controller.h"
@@ -1,3 +1,11 @@
/*
File: MenuHelper.h
Description: Header file declaring the MenuHelper class, which provides
utility functions for menu-driven operations such as
notification selection and display.
Author: Trenser
Date:19-May-2026
*/
#pragma once
#include <string>
#include <iomanip>
@@ -6,6 +14,14 @@
#include "InputHelper.h"
#include "OutputHelper.h"
/*
Function: selectNotification
Description: Displays a list of notifications with index, ID, title, and timestamp.
Allows the user to select a notification by index. Returns the selected
notification or nullptr if the selection is invalid.
Parameter: const util::Vector<const Notification*>& notifications - list of notifications
Return type: const Notification* - pointer to the selected notification
*/
inline const Notification* selectNotification(const util::Vector<const Notification*>& notifications)
{
if (notifications.getSize() == 0)
@@ -1,3 +1,11 @@
/*
File: UserInterface.cpp
Description: Implementation file containing the method definitions of the
UserInterface class, including system run loop, login handling,
and customer registration logic.
Author: Trenser
Date:19-May-2026
*/
#include "UserInterface.h"
#include "InputHelper.h"
#include "OutputHelper.h"
@@ -5,6 +13,13 @@
#include "User.h"
#include "Validator.h"
/*
Function: run
Description: Runs the main system loop, displaying the initial menu for login,
customer registration, or exit. Handles exceptions gracefully.
Parameter: None
Return type: void
*/
void UserInterface::run()
{
bool isMenuActive = true;
@@ -29,6 +44,12 @@ void UserInterface::run()
}
}
/*
Function: handleOperation
Description: Executes the corresponding system operation based on the selected menu choice.
Parameter: int choice - selected menu option
Return type: bool - true if menu continues, false if exit
*/
bool UserInterface::handleOperation(int choice)
{
switch (choice)
@@ -49,6 +70,13 @@ bool UserInterface::handleOperation(int choice)
return true;
}
/*
Function: login
Description: Handles user login by validating credentials. Based on the authenticated
user type, navigates to the appropriate menu (Admin, Technician, Customer).
Parameter: None
Return type: void
*/
void UserInterface::login()
{
std::string username, password;
@@ -85,6 +113,14 @@ void UserInterface::login()
}
}
/*
Function: registerCustomer
Description: Registers a new customer by collecting and validating details such as
username, name, email, password, and phone number. Delegates creation
to the controller.
Parameter: None
Return type: void
*/
void UserInterface::registerCustomer()
{
std::string username, name, email, phone, password;
@@ -1,3 +1,12 @@
/*
File: UserInterface.h
Description: Header file declaring the UserInterface class, which provides
the main entry point for the Vehicle Service System. Handles
login, customer registration, and menu navigation for different
user roles (Admin, Technician, Customer).
Author: Trenser
Date:19-May-2026
*/
#pragma once
#include "Controller.h"
#include "AdminMenu.h"