Files
Training-VehicleService-May26/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/models/ServiceBooking.h
T
Jissin Mathew 4b76cae358 Implement Model Refactoring
<UserStory> 1955: Model Refactoring</UserStory>

UserStory #1955

<Changes>
1. Replaced CSV-based serialization and deserialization in ComboPackage, JobCard, Service, and ServiceBooking models with fixed-size SerializedRecord structures for shared memory storage.
2. Implemented serialize() methods to convert objects into SerializedComboPackage, SerializedJobCard, SerializedService, and SerializedServiceBooking records.
3. Implemented deserialize() methods to reconstruct objects directly from SerializedRecord types instead of parsing CSV strings.
4. Updated model class interfaces to use SerializedRecord types, removing legacy CSV serialization APIs and header generation functions.
5. Added SerializedRecords.h dependencies and forward declarations for Serialized structures across affected models.
</Changes>

<Test>
N/A
</Test>

<Review>
Sreeja Reghukumar, please review
</Review>
2026-06-12 03:22:13 +05:30

85 lines
2.9 KiB
C++

/*
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"
#include "Vector.h"
#include "Enums.h"
class Service;
class User;
struct SerializedServiceBooking;
class ServiceBooking
{
private:
static int m_uid;
std::string m_id;
util::ServiceJobStatus m_status;
util::Vector<std::string> m_serviceIDs;
util::Map<std::string, Service*> m_services;
std::string m_customerId;
User* m_customer;
std::string m_vehicleNumber;
std::string m_vehicleBrand;
std::string m_vehicleModel;
std::string m_assignedTechnicianId;
User* m_assignedTechnician;
double m_discountPercentage;
public:
ServiceBooking();
ServiceBooking(
util::ServiceJobStatus status,
const util::Map<std::string,
Service*>& services,
const std::string& customerId,
User* customer,
const std::string& vehicleNumber,
const std::string& vehicleBrand,
const std::string& vehicleModel,
double discountPercentage
);
ServiceBooking(
const std::string& id,
util::ServiceJobStatus status,
const util::Vector<std::string>& serviceIDs,
const std::string& customerId,
const std::string& vehicleNumber,
const std::string& vehicleBrand,
const std::string& vehicleModel,
const std::string& assignedTechnicianId,
double discountPercentage
);
const std::string& getId() const;
util::ServiceJobStatus getStatus() const;
const util::Vector<std::string>& getServiceIDs() const;
const util::Map<std::string, Service*>& getServices() const;
const std::string& getCustomerId() const;
User* getCustomer() const;
const std::string& getVehicleNumber() const;
const std::string& getVehicleBrand() const;
const std::string& getVehicleModel() const;
const std::string& getAssignedTechnicianId() const;
User* getAssignedTechnician() const;
double getDiscountPercentage() const;
void setId(const std::string& id);
void setStatus(const util::ServiceJobStatus& status);
void setServices(const util::Map<std::string, Service*>& services);
void setCustomerId(const std::string& customerId);
void setCustomer(User* customer);
void setVehicleNumber(const std::string& vehicleNumber);
void setVehicleBrand(const std::string& vehicleBrand);
void setVehicleModel(const std::string& vehicleModel);
void setAssignedTechnicianId(const std::string& assignedTechnicianId);
void setAssignedTechnician(User* assignedTechnician);
void setDiscountPercentage(double discountPercentage);
SerializedServiceBooking serialize() const;
static ServiceBooking* deserialize(const SerializedServiceBooking&);
};