211 lines
6.0 KiB
C++
211 lines
6.0 KiB
C++
/*
|
|
File: Controller.cpp
|
|
Description: Implementation file containing the method definitions
|
|
of the Controller class, which manages user authentication,
|
|
inventory, services, bookings, and notifications.
|
|
Author: Trenser
|
|
Date:19-May-2026
|
|
*/
|
|
#include "Controller.h"
|
|
|
|
/*
|
|
Function: login
|
|
Description: Authenticates a user based on provided credentials.
|
|
Parameter: const std::string& username - the username of the user
|
|
const std::string& password - the password of the user
|
|
Return type: bool
|
|
*/
|
|
bool Controller::login(const std::string& username, const std::string& password)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
void Controller::logout()
|
|
{
|
|
}
|
|
|
|
void Controller::changePassword(const std::string& newPassword)
|
|
{
|
|
}
|
|
|
|
void Controller::createCustomer(const std::string& username, const std::string& password, const std::string& email, const std::string& phone)
|
|
{
|
|
}
|
|
|
|
const User* Controller::getAuthenticatedUser()
|
|
{
|
|
return nullptr;
|
|
}
|
|
|
|
void Controller::createTechnician(const std::string& username, const std::string& password, const std::string& email, const std::string& phone)
|
|
{
|
|
}
|
|
|
|
void Controller::updateUserDetails(const std::string& email, const std::string& phone)
|
|
{
|
|
}
|
|
|
|
util::Map<std::string, const Service*> Controller::getServices()
|
|
{
|
|
return util::Map<std::string, const Service*>();
|
|
}
|
|
|
|
util::Map<std::string, const ComboPackage*> Controller::getComboPackages()
|
|
{
|
|
return util::Map<std::string, const ComboPackage*>();
|
|
}
|
|
|
|
void Controller::purchaseService(const util::Vector<std::string>& serviceIDs, const std::string& vehicleNumber, const std::string& vehicleBrand, const std::string& vehicleModel)
|
|
{
|
|
}
|
|
|
|
void Controller::purchaseComboPackage(const std::string& comboPackageID, const std::string& vehicleNumber, const std::string& vehicleBrand, const std::string& vehicleModel)
|
|
{
|
|
}
|
|
|
|
/*
|
|
Function: getInventoryItems
|
|
Description: Retrieves all inventory items from the inventory management service
|
|
and constructs a read-only map for external use.
|
|
Parameter: None
|
|
Return type: util::Map<std::string, const InventoryItem*>
|
|
*/
|
|
util::Map<std::string, const InventoryItem*> Controller::getInventoryItems()
|
|
{
|
|
auto inventoryIems = m_inventoryManagementService.getInventoryItems();
|
|
util::Map<std::string, const InventoryItem*> readOnlyInventoryItems;
|
|
int inventoryItemsMapSize = inventoryIems.getSize();
|
|
for (int index = 0; index < inventoryItemsMapSize; index++)
|
|
{
|
|
readOnlyInventoryItems.insert(inventoryIems.getKeyAt(index), inventoryIems.getValueAt(index));
|
|
}
|
|
return readOnlyInventoryItems;
|
|
}
|
|
|
|
/*
|
|
Function: getInventoryItem
|
|
Description: Retrieves a specific inventory item by its ID from the inventory management service.
|
|
Parameter: const std::string& inventoryItemID - ID of the inventory item
|
|
Return type: const InventoryItem*
|
|
*/
|
|
const InventoryItem* Controller::getInventoryItem(const std::string& inventoryItemID)
|
|
{
|
|
return m_inventoryManagementService.getInventoryItem(inventoryItemID);
|
|
}
|
|
|
|
/*
|
|
Function: addInventoryItem
|
|
Description: Adds a new inventory item with specified details to the inventory management service.
|
|
Parameter: const std::string& partName - name of the part
|
|
int quantity - quantity of the part
|
|
double price - price of the part
|
|
Return type: void
|
|
*/
|
|
void Controller::addInventoryItem(const std::string& partName, int quantity, double price)
|
|
{
|
|
m_inventoryManagementService.addInventoryItem(partName, quantity, price);
|
|
}
|
|
|
|
/*
|
|
Function: removeInventoryItem
|
|
Description: Removes an inventory item from the inventory management service by its ID.
|
|
Parameter: const std::string& inventoryItemID - ID of the inventory item
|
|
Return type: void
|
|
*/
|
|
void Controller::removeInventoryItem(const std::string& inventoryItemID)
|
|
{
|
|
m_inventoryManagementService.removeInventoryItem(inventoryItemID);
|
|
}
|
|
|
|
/*
|
|
Function: addInventoryItemStock
|
|
Description: Adds stock to an existing inventory item in the inventory management service.
|
|
Parameter: const std::string& selectedItemId - ID of the inventory item
|
|
int quantity - quantity to add
|
|
Return type: void
|
|
*/
|
|
void Controller::addInventoryItemStock(const std::string& selectedItemId, int quantity)
|
|
{
|
|
m_inventoryManagementService.addInventoryItemStock(selectedItemId, quantity);
|
|
}
|
|
|
|
util::Map<std::string, const ServiceBooking*> Controller::getServiceBookings()
|
|
{
|
|
return util::Map<std::string, const ServiceBooking*>();
|
|
}
|
|
|
|
util::Map<std::string, const ServiceBooking*> Controller::getServiceBookingsByUser(const std::string userID)
|
|
{
|
|
return util::Map<std::string, const ServiceBooking*>();
|
|
}
|
|
|
|
util::Map<std::string, const User*> Controller::getUsers()
|
|
{
|
|
return util::Map<std::string, const User*>();
|
|
}
|
|
|
|
util::Map<std::string, const User*> Controller::getUsers(util::UserType userType)
|
|
{
|
|
return util::Map<std::string, const User*>();
|
|
}
|
|
|
|
void Controller::createJobCard(const std::string& bookingID, const std::string& technicianID, const std::string& serviceID)
|
|
{
|
|
}
|
|
|
|
void Controller::createService(const std::string& name, const util::Vector<std::string>& inventoryItemIDs, double laborCost)
|
|
{
|
|
}
|
|
|
|
void Controller::removeService(const std::string& serviceID)
|
|
{
|
|
}
|
|
|
|
util::Map<std::string, const JobCard*> Controller::getJobCardsByUser()
|
|
{
|
|
return util::Map<std::string, const JobCard*>();
|
|
}
|
|
|
|
void Controller::completeJob(const std::string& jobID)
|
|
{
|
|
}
|
|
|
|
void Controller::removeUser(const std::string& userID)
|
|
{
|
|
}
|
|
|
|
void Controller::createComboPackage(const std::string& name, const util::Vector<std::string>& serviceIDs, double discountPercentage)
|
|
{
|
|
}
|
|
|
|
void Controller::removeComboPackage(const std::string& comboPackageID)
|
|
{
|
|
}
|
|
|
|
util::Map<std::string, const Invoice*> Controller::getInvoicesByUser()
|
|
{
|
|
return util::Map<std::string, const Invoice*>();
|
|
}
|
|
|
|
void Controller::completePayment(const std::string& invoiceID, util::PaymentMode paymentMode)
|
|
{
|
|
}
|
|
|
|
util::Vector<const Notification*> Controller::getNotifications()
|
|
{
|
|
return util::Vector<const Notification*>();
|
|
}
|
|
|
|
void Controller::deleteNotification(const std::string& notificationID)
|
|
{
|
|
}
|
|
|
|
void Controller::configureNotifications(const std::string& userID, bool paymentNotifications, bool serviceNotifications)
|
|
{
|
|
}
|
|
|
|
void Controller::runSystemChecks()
|
|
{
|
|
}
|
|
|