// // Created by trotfunky on 02/10/2021. // #ifndef AUTOPOINTSPERMIS_LICENCEOPERATIONS_H #define AUTOPOINTSPERMIS_LICENCEOPERATIONS_H #include #include #include #include #include "db_info.h" // Assign values directly to prevent starting from 0 without using a dummy value enum class offenceClass { One = 1, Two = 2, Three = 3, Four = 4, Five = 5 }; void dbError(const std::string& errorMessage, char* dbError); /// Adds a new licence with 12 points and no counters running. int addNewLicence(sqlite3* db, const std::string& licenceID); /// Apply a new offence to an existing licence. int applyOffence(sqlite3* db, const std::string& licenceID, int lostPoints, offenceClass offenceClass); /// Apply the countdowns, check for completion and add points back. /// Fetched columns : idHash, Points, Countdown, OnePointCoutdown, TenYearCountdown int countdown(void* db, int columnCount, char** rowData, char** columnNames); /// Resets all counters and maximum points for an existing licence int reset(sqlite3* db, const std::string& idHash); #endif //AUTOPOINTSPERMIS_LICENCEOPERATIONS_H