#ifndef __HCM4A_CalcFS4A_dtTriger_h_
#define __HCM4A_CalcFS4A_dtTriger_h_

struct TrigerRec :Moveable<TrigerRec>{
	int id;
	String name;
	double longitude;
	double latitude;
	double azimuth;
	int h_asl;
	String reference;
	String countries;
	int error;
	void Clear(){
		id = 0;
		name = "";
		longitude = 0.0;
		latitude = 0.0;
		azimuth = 0.0;
		h_asl = 0;
		reference = "";
		countries = "";
		error = 0;
	}
	void Jsonize(JsonIO& json){
		json
		("id", id)
		("name", name)
		("longitude", longitude)
		("latitude", latitude)
		("azimuth", azimuth)
		("h_asl", h_asl)
		("reference", reference)
		("countries", countries)
		("error", error)
		;
	}
	String ToJsonStr()const{return StoreAsJson(*this);};
	void FromJsonStr(const String& s){LoadFromJson(*this, s);};
	String ToString()const{
		return String()
			<< "	id: " <<  id << "\n"
			<< "	name: " <<  name << "\n"
			<< "	longitude: " <<  longitude << "\n"
			<< "	latitude: " <<  latitude << "\n"
			<< "	azimuth: " <<  azimuth << "\n"
			<< "	h_asl: " <<  h_asl << "\n"
			<< "	reference: " <<  reference << "\n"
			<< "	countries: " <<  countries << "\n"
			<< "	error: " <<  error << "\n"
		;
	}
	void Set(const TrigerRec& rec){
		Clear();
		id = rec.id;
		name = rec.name;
		longitude = rec.longitude;
		latitude = rec.latitude;
		azimuth = rec.azimuth;
		h_asl = rec.h_asl;
		reference = rec.reference;
		countries = rec.countries;
		error = rec.error;
	}
	void Set(const HcmRec& hrec, const String& clist, int er){
		Clear();
		name = hrec.name_of_station;
		longitude = hrec.longitude;
		latitude = hrec.latitude;
		azimuth = hrec.azimuth;
		h_asl = hrec.h_asl;
		reference = hrec.coord_ref;
		countries = clist;
		error = er;
	}
	void Set(const String& jStr){
		Clear();FromJsonStr(jStr);
	}
	bool IsEmpty(){
		return id == 0;
	}
	void FillTitle(Vector<String>& title){
		title.Clear();
		//title.Add("id");
		title.Add("name");
		title.Add("longitude");
		title.Add("latitude");
		title.Add("azimuth");
		title.Add("h_asl");
		title.Add("reference");
		title.Add("countries");
		title.Add("error");
	}
	void FillData(Vector<String>& data){
		data.Clear();
		//data.Add(String() << IntStr(id));
		data.Add(String() << (name));
		data.Add(String() << DblStr(longitude));
		data.Add(String() << DblStr(latitude));
		data.Add(String() << DblStr(azimuth));
		data.Add(String() << IntStr(h_asl));
		data.Add(String() << (reference));
		data.Add(String() << (countries));
		data.Add(String() << (error));
	}
	TrigerRec(){Clear();};
	TrigerRec(const String& jstr){Clear();FromJsonStr(jstr);};
	TrigerRec(
		const int id,
		const String& name,
		double longitude,
		double latitude,
		double azimuth,
		int h_asl,
		const String& reference,
		const String& countries,
		const int error
	):
		id(id),
		name(name),
		longitude(longitude),
		latitude(latitude),
		azimuth(azimuth),
		h_asl(h_asl),
		reference(reference),
		countries(countries),
		error(error)
	{}
	TrigerRec(const TrigerRec& rec):
		id(rec.id),
		name(rec.name),
		longitude(rec.longitude),
		latitude(rec.latitude),
		azimuth(rec.azimuth),
		h_asl(rec.h_asl),
		reference(rec.reference),
		countries(rec.countries),
		error(rec.error)
	{}
	TrigerRec(const HcmRec& hrec, const String& clist, int er){
		Clear();
		name = hrec.name_of_station;
		longitude = hrec.longitude;
		latitude = hrec.latitude;
		azimuth = hrec.azimuth;
		h_asl = hrec.h_asl;
		reference = hrec.coord_ref;
		countries = clist;
		error = er;
	}
};
//!---------------------------------------------------------------------------------------------


#endif
