Website Summary Files Commits Branches @commit @diff @stats
path: root / src / Services / EventService.h
diff options
context:
space:
mode:
Commitb3d493796c97178f597ecf97e7c1ae46e566fe9c (patch)
Author
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-08 21:24:07 +0300
Committer
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-08 21:24:07 +0300
Filescd7364f8d9f6e8ed7da87363e5e04c47ca02e8b1 /src/Services/EventService.h
FMI-OOP-P1_TicketSystem-b3d493796c97178f597ecf97e7c1ae46e566fe9c.tar
FMI-OOP-P1_TicketSystem-b3d493796c97178f597ecf97e7c1ae46e566fe9c.tar.gz
FMI-OOP-P1_TicketSystem-b3d493796c97178f597ecf97e7c1ae46e566fe9c.zip
Parentbf7689ba06764b72a6212549a5c8a39e294cceee (diff)
Fully documented everything in Services
1 files changed, 22 insertions, 4 deletions
-rw-r--r--src/Services/EventService.h26
diff --git a/src/Services/EventService.h b/src/Services/EventService.h
index c56620b..f6c94ca 100644
--- a/src/Services/EventService.h
+++ b/src/Services/EventService.h
@@ -1,46 +1,64 @@
#ifndef HEADER_SERVICES_EVENTSERVICE
#define HEADER_SERVICES_EVENTSERVICE
+/*! \file EventService.h
+ * \brief Stores the declaration of class EventService
+ */
+
#include "../Generic/List/OrderedList.hpp"
#include "../Generic/Date/Date.h"
#include "../Models/Event.h"
#include "HallService.h"
#include "StatusCode.h"
+/*! \brief Each EventService stores all events and a pointer to HallService
+ */
class EventService {
OrderedList<Event> events;
- unsigned indSoonestUpcoming;
const HallService* hs;
- void updateSoonestUpcoming();
unsigned indexOfEvent(const char* name, const Date& date);
public:
+ //! Sets HallService pointer and initializes events List
EventService(const HallService* hs);
+ //! Sets HallService pointer and copies values from events into events List
EventService(const HallService* hs, const Event* events, unsigned eventCount);
+ //! Creates an Event, with the given hallNumber, name and date
StatusCode createEvent(int hallNumber, const String& name, const Date& date);
+ //! Cancels an Event with the given name and date
StatusCode cancelEvent(const char* name, const Date& date);
+ //! Creates a Reservation for an Event by name and date
StatusCode reserveTicket(const char* name, const Date& date, const char* password, const char* note, const Ticket& ticket);
-
+ //! Cancels a Reservation for a ticket
StatusCode cancelTicketReservation(const char* name, const Date& date, const Ticket& ticket);
-
+ //! Whether a ticket is a reserved or not
StatusCode ticketIsReserved(const char* name, const Date& date, const Ticket& ticket);
+ //! Buys ticket, assuming it is reserved and stores the reservation note
StatusCode buyTicket(const char* name, const Date& date, const Ticket& ticket, const char* password, String* reservationNoteOutput);
+ //! Buys ticket, assuming it isn't reserved
StatusCode buyTicket(const char* name, const Date& date, const Ticket& ticket);
+ //! Creates a special String for status of all seats in given Event (by name and date) and returns seatsPerRow in given pointer
String createSeatingString(const char* name, const Date& date, unsigned* seatsPerRow);
+ //! \return A List of topN most watched Events
List<Event> queryMostWatched(unsigned topN);
+ //! \return A List of events which have attracted sales of less than 10% of the Hall's seat
List<Event> queryInsufficientlyVisited();
+ //! Creates a report that lists all Events (with given name and date) and their reserved tickets
StatusCode reportReservations(const char* name, const Date& date);
+ //! Creates a report that Lists all Events (with given name and date) and number of bought tickets
StatusCode reportBoughtTickets(int hallNumber, const Date& start, const Date& end, bool all = false);
+ //! Loads Events from a database file
StatusCode load();
+ //! Saves Events to a database file
StatusCode save();
};