2019-05-28 16:46:55 +00:00
|
|
|
#ifndef CUSTOMER_H
|
|
|
|
#define CUSTOMER_H
|
|
|
|
#pragma once
|
2019-06-30 02:22:58 +00:00
|
|
|
|
2019-05-28 16:46:55 +00:00
|
|
|
#include "Park_time.h"
|
2019-06-30 02:22:58 +00:00
|
|
|
#include "data.h"
|
2019-06-30 03:37:18 +00:00
|
|
|
|
2019-06-26 18:12:23 +00:00
|
|
|
#include <random>
|
|
|
|
#include <vector>
|
2019-05-28 16:46:55 +00:00
|
|
|
|
2019-06-26 18:12:23 +00:00
|
|
|
using std::vector;
|
2019-05-28 16:46:55 +00:00
|
|
|
|
2019-06-30 03:37:18 +00:00
|
|
|
// 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 };
|
2019-06-20 11:08:02 +00:00
|
|
|
|
2019-05-28 16:46:55 +00:00
|
|
|
/*
|
2019-06-30 03:37:18 +00:00
|
|
|
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.
|
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-30 03:37:18 +00:00
|
|
|
Customer(int id_, string name_, // needed to construct from db
|
|
|
|
string card_code_,
|
|
|
|
Verhicle_type verhicle_, // TODO: how init. p_time instances?
|
|
|
|
vector<Park_time> instances);
|
2019-06-30 02:22:58 +00:00
|
|
|
~Customer();
|
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
|