2019-05-28 16:46:55 +00:00
|
|
|
#ifndef CUSTOMER_H
|
|
|
|
#define CUSTOMER_H
|
|
|
|
#pragma once
|
2019-06-26 18:12:23 +00:00
|
|
|
#include "../thirdparty/SQLiteCpp/include/SQLiteCpp/SQLiteCpp.h"
|
2019-05-28 16:46:55 +00:00
|
|
|
#include "Park_time.h"
|
2019-06-26 18:12:23 +00:00
|
|
|
#include <ctime>
|
|
|
|
#include <random>
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
2019-06-30 00:50:36 +00:00
|
|
|
#include "data.h"
|
2019-05-28 16:46:55 +00:00
|
|
|
|
|
|
|
using std::string;
|
2019-06-26 18:12:23 +00:00
|
|
|
using std::vector;
|
2019-05-28 16:46:55 +00:00
|
|
|
|
2019-06-30 01:48:49 +00:00
|
|
|
// will make it easy to represent it in the database while making it easy to use while programming
|
2019-06-20 11:08:02 +00:00
|
|
|
enum class Verhicle_type {
|
2019-06-30 01:48:49 +00:00
|
|
|
bike = 1,
|
|
|
|
small_car = 2,
|
|
|
|
suv = 3,
|
|
|
|
pickup = 4
|
2019-06-20 11:08:02 +00:00
|
|
|
};
|
|
|
|
|
2019-05-28 16:46:55 +00:00
|
|
|
/*
|
2019-06-27 02:32:06 +00:00
|
|
|
card code is een randomly generated string moeten zijn, die je bv. op een nfc card zou opslaan en zo zou
|
2019-06-20 11:08:02 +00:00
|
|
|
authenticaten bij je parking spot. We kunnen dit ipv of samen met een password gebruiken.
|
|
|
|
clock in en out creeert en compleet een park_time object. Voegt het toe aan een vector.
|
2019-05-28 16:46:55 +00:00
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
class Customer {
|
2019-06-26 18:12:23 +00:00
|
|
|
public:
|
2019-06-30 00:50:36 +00:00
|
|
|
Customer(string name_, Verhicle_type verhicle_);
|
2019-06-27 02:32:06 +00:00
|
|
|
Customer(int id_, string name_, string card_code_, Verhicle_type verhicle_,
|
|
|
|
vector<Park_time> instances); // needed to construct from db
|
|
|
|
// potentially: add a destructor that calls update_db() before being destroyed
|
2019-05-28 16:46:55 +00:00
|
|
|
int id;
|
|
|
|
string name;
|
|
|
|
string card_code;
|
2019-06-27 02:32:06 +00:00
|
|
|
|
2019-05-28 16:46:55 +00:00
|
|
|
void clock_in(int s_id);
|
|
|
|
void clock_out(int s_id);
|
2019-06-27 02:32:06 +00:00
|
|
|
|
2019-06-30 00:50:36 +00:00
|
|
|
void update_db();
|
|
|
|
void delete_db();
|
2019-06-27 02:32:06 +00:00
|
|
|
|
2019-06-30 01:48:49 +00:00
|
|
|
void gen_monthly(); // remove, make it a function in data
|
2019-05-28 16:46:55 +00:00
|
|
|
|
2019-06-26 18:12:23 +00:00
|
|
|
private:
|
2019-06-20 11:08:02 +00:00
|
|
|
Verhicle_type verhicle;
|
2019-05-28 16:46:55 +00:00
|
|
|
vector<Park_time> park_instances;
|
2019-06-27 02:32:06 +00:00
|
|
|
|
2019-06-26 18:12:23 +00:00
|
|
|
string gen_cardcode();
|
2019-06-30 00:50:36 +00:00
|
|
|
void save_db();
|
|
|
|
int auto_increment_db();
|
2019-05-28 16:46:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CUSTOMER_H
|