#ifndef ENGINE_STRUCT
# define ENGINE_STRUCT

#include <core.h>
#include <enum.h>

typedef struct {
	Font fonts[4];//
	Texture	textures;//
	Model	models;//
	Sound	sound;
}	Assets;

// Event
typedef struct {
	EVENT_TYPE	type;
	int			value;
	double		time;
	char*		info;
	int			initiator;
	int			actors;
	int			actions;
}	Event;

//cities
//hideout
//tiles
//level
//npc
//clan
//army
//team

typedef struct {

}	Damage;

typedef struct {
	EVENT_TYPE		trigger;
	ACTIVITY_STATE	required_state;
	bool			(*condition)(int e, Event ev);
	void			*(*effect)(int e, Event ev);
}	virtualRule;

typedef struct {
	EVENT_TYPE		trigger;
	ACTIVITY_STATE	required_state;
	bool			(*condition)(int e, Event ev);
	void			*(*effect)(int e, Event ev);
}	physicalRule;

typedef struct {
	int strenght;
	int agility;
	int toughness;
	int	proprioception;
	int	earing;
	int	touch;
	int	eyesight;
}	BodyStats;

typedef struct {
	int	intellect;
	int fortitude;
	int charisma;
	int eloquence;
	int perception;
}	MentalStats;

typedef struct {
	LIMB_TYPE	type;
	LIMB_STATE	state;
}	Limb;

typedef struct {
	Limb		limbs[10];
	BodyStats	body_stats;
	MentalStats	mental_stats;
	int			mass;
	Vector3		pos;
	Vector3		velocity;
	int			health;
}	Body;

typedef struct {
	Body			body;
	int				faction;
	ENTITY_STATE	state;//can be multiple flag
}	Entity;

typedef struct {
	Entity entity;
	void	(*ai)(void);
}	Mob;

// Item

typedef struct {
	int	number;
	int	description;//ref to item description table
	int	name;//ref to item name table
	int	rarity;
	int	flags;
	int	stack;
}	Item;

/*
inventory could be a grid that have an item focused,
the item focused have a description and stats windows on the left,
the focused item is either the one under the mouse
or can be choosen using arrow keys (easier controller support)
*/
typedef struct {
	int		size;
	int		capacity;
	Item	storage[100];
}	Inventory;

// Player

typedef struct {
	char	*name;
	char	*gender;
	char	*nickname;//can be changed, what npc refers to when talking to you, also npc do not know you until you interact with them
}	Identity;

typedef struct {
}	Skill;

typedef struct {
	Entity		entity;
	Identity	identity;
	Skill		skills[10];
	Inventory	inventory;
}	Player;
//give more enphasis on the character than the item used (~60% ,~30%)

// Quest & Task
typedef struct {
	int	id;
	int	prerequisite;
	int	objectiv;
	int	status;//unknow, known, accepted, achieved, completed, unavailable
}	Quest;

//Quest are missive or Scroll that the player can open with info on it, but no mini map or marker Also the map should be another scroll that is handdrawn, and the player can put marker and orient himself using landscape point of interest

// Other Struct

typedef struct {
	int		key[4];//should be the number of action in PLAYER_ACTION
	union {
		int		key;
		int		pad;
		int		mouse;
	}	press;
	Vector2	mouse_pos;
	Vector2	mouse_delta;
	//int		mouse_pressed[2];
}	Input;

typedef struct {
	int state;
	Player player;
	Assets assets;
}	Context;

# endif
