/*
City.h

This defines the class components of the class City, which will be instantiated
in a simulation, in order to store and track data for each "location" inside the
virtual representation of a city.
*/
#ifndef CITY
#define CITY

#include <iostream>
#include <cstdlib> 
#include <ctime> 
#include <iostream> 
#include <string>
 
using namespace std;

/* This struct is the data type that represents each location in a city, and
   consequently must store several pieces of information.
*/
struct GridLocation{
	bool infected;
	bool vaccinated;
	int day;
	int vaccinationDay;
	int infectionDay;
	bool highRisk;
};
class City{

public:
	// Constructors, destructor
	City(char code, int numRow, int numCols);
	City();
	~City();
	
	//////////////
	// Accessor methods (const)
	
	// General city information accessor methods (const)
	int GetRows() const;
	int GetColumns() const;
	char GetCityCode() const;
	int GetDayNumber()const;
	double GetVaccineIneffectiveness() const;
	
	// Single location accessor methods (const)
	bool IsHighRisk(int r, int c) const;
	bool IsUnaffected(int r, int c) const;
	bool IsVaccinated(int r, int c) const;
	bool IsInfected(int r, int c) const;
	bool IsContagious(int r, int c) const;
	
	// Entire city grid statistics accessors (const)
	long NumberInfected() const;
	long NumberVaccinated() const;
	long NumberVaccinatedAndInfected() const;
	
	// Print methods (const)
	void Print() const;
	void StreamPrint(ostream&out) const;
	void PrintDay(int dayToPrint) const;
	string PrintGrid() const;
	
	
	//////////////
	// Modifiers
	
	// General city information modifiers
	void SetVaccineIneffectiveness(double probability);
	void SetDaysUntilVaccineEffective(int days);
	void SetDaysContagious(int numberOfDays);
	void FixGrid(int newDay);
	
	// Single location modifiers
	bool VaccinateLocation(int r, int c);
	bool InfectLocation(int r, int c);
	void SetHighRisk(int r, int c);

	
private:
	///////////////
	// Variables
	char cityCode;
	int numRows;
	int numColumns;
	GridLocation * grid;
	int currentDay;
	int daysContagious;
	int daysTillVaccineEffective;
	double vaccineIneffectiveness;	//probability the vaccine is not effective, ranging (0-1)
	
	///////////////
	// Helper functions
	bool adjacentInfectionCheck(int r, int c) const;
};

// overloaded << operator
ostream &operator<<(ostream &out, const City &cityToPrint);

#endif
