type int = number;


type float = number;


type type_conf =
{
	backend:
	{
		scheme: string;
		host: string;
		port: int;
		path: string;
	};
	settings:
	{
		poll_interval_in_milliseconds: 2000;
	};
	irc:
	{
		server: string;
		predefined_channel: string;
		predefined_nickname_prefix: string;
	}
};


enum enum_state
{
	offline = "offline",
	connecting = "connecting",
	online = "online",
}


type type_event =
{
	timestamp: int;
	kind: string;
	data: any;
};


type type_spot =
{
	kind: string;
	name: string;
};


type type_entry =
{
	timestamp: int;
	sender: string;
	content: string;
};


type type_user =
{
	name: string;
	role: string;
};


type type_channel =
{
	users: Array<type_user>;
	entries: Array<type_entry>;
};


type type_query =
{
	entries: Array<type_entry>;
};


type type_model =
{
	state: enum_state;
	connection_id: (null | string);
	nickname: (null | string);
	channels: Record<string, type_channel>;
	queries: Record<string, type_query>;
	active: (null | type_spot);
	listeners: Record<string, Array<(details?: any)=>void>>;
};