Parkmanne/headers/Customer.h

54 lines
1.5 KiB
C
Raw Normal View History

2019-05-28 16:46:55 +00:00
#ifndef CUSTOMER_H
#define CUSTOMER_H
#pragma once
2019-05-28 16:46:55 +00:00
#include "Park_time.h"
#include "data.h"
2019-06-26 18:12:23 +00:00
#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
// 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
/*
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:
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);
2019-05-28 16:46:55 +00:00
void clock_in(int s_id);
void clock_out(int s_id);
2019-06-30 00:50:36 +00:00
void update_db();
void delete_db();
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-30 00:50:36 +00:00
void save_db();
int auto_increment_db();
2019-05-28 16:46:55 +00:00
};
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
2019-05-28 16:46:55 +00:00
#endif // CUSTOMER_H