55 lines
1.5 KiB
C++
55 lines
1.5 KiB
C++
#ifndef CUSTOMER_H
|
|
#define CUSTOMER_H
|
|
#pragma once
|
|
|
|
#include "Park_time.h"
|
|
#include "data.h"
|
|
|
|
#include <vector>
|
|
|
|
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:
|
|
int id;
|
|
string name;
|
|
string password;
|
|
Customer(string name_, string password_, Verhicle_type verhicle_);
|
|
Customer(int id_, string name_, // needed to construct from db
|
|
string password_,
|
|
Verhicle_type verhicle_, // TODO: how init. p_time instances?
|
|
vector<Park_time> instances);
|
|
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
|
|
Verhicle_type verhicle;
|
|
|
|
private:
|
|
vector<Park_time> park_instances;
|
|
void save_db();
|
|
int auto_increment_db();
|
|
};
|
|
|
|
static vector<Customer> park_customers;
|
|
// save the customers that are parked in here
|
|
// parking_spot uses pointers, so it's better to save the parked customers here
|
|
// where we know they'll be destroyed at the end of this scope, instead of too
|
|
// early and end up with dangling pointers
|
|
|
|
#endif // CUSTOMER_H
|