57 lines
1.4 KiB
C++
57 lines
1.4 KiB
C++
#ifndef CUSTOMER_H
|
|
#define CUSTOMER_H
|
|
#pragma once
|
|
#include "../thirdparty/SQLiteCpp/include/SQLiteCpp/SQLiteCpp.h"
|
|
#include "Park_time.h"
|
|
#include <ctime>
|
|
#include <random>
|
|
#include <string>
|
|
#include <vector>
|
|
#include "data.h"
|
|
|
|
using std::string;
|
|
using std::vector;
|
|
|
|
// will make it easy to represent it in the database while making it easy to use while programming
|
|
enum class Verhicle_type {
|
|
bike = 1,
|
|
small_car = 2,
|
|
suv = 3,
|
|
pickup = 4
|
|
};
|
|
|
|
/*
|
|
card code is een randomly generated string moeten zijn, die je bv. op een nfc card zou opslaan en zo zou
|
|
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.
|
|
|
|
*/
|
|
|
|
class Customer {
|
|
public:
|
|
Customer(string name_, Verhicle_type verhicle_);
|
|
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
|
|
int id;
|
|
string name;
|
|
string card_code;
|
|
|
|
void clock_in(int s_id);
|
|
void clock_out(int s_id);
|
|
|
|
void update_db();
|
|
void delete_db();
|
|
|
|
void gen_monthly(); // remove, make it a function in data
|
|
|
|
private:
|
|
Verhicle_type verhicle;
|
|
vector<Park_time> park_instances;
|
|
|
|
string gen_cardcode();
|
|
void save_db();
|
|
int auto_increment_db();
|
|
};
|
|
|
|
#endif // CUSTOMER_H
|