/*
This file is part of »zeitbild«.

Copyright 2025 'kcf' <fenris@folksprak.org>

»zeitbild« is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

»zeitbild« is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License
along with »zeitbild«. If not, see <http://www.gnu.org/licenses/>.
 */


/**
 */
namespace _zeitbild
{
	
	/**
	 */
	export enum enum_access_level {
		none,
		view,
		edit,
		admin
	}
	
	
	/**
	 */
	export type type_group_id = int;
	
	
	/**
	 */
	export type type_group_object = {
		name : string;
		label : string;
	};
	
	
	/**
	 */
	export type type_user_id = int;
	
	
	/**
	 */
	export type type_user_object = {
		name : string;
		groups : Array<
			type_group_id
		>;
		email_address : (
			null
			|
			string
		);
		dav_token : (
			null
			|
			string
		);
	};
	
	
	/**
	 */
	export type type_event_object = {
		/**
		 * @todo rename to "title"
		 */
		name : string;
		begin : lib_plankton.pit.type_datetime;
		end : (
			null
			|
			lib_plankton.pit.type_datetime
		);
		location : (
			null
			|
			string
		);
		link : (
			null
			|
			string
		);
		description : (
			null
			|
			string
		);
	};
	
	
	/**
	 */
	export type type_local_resource_event_id = int;
	
	
	/**
	 */
	export type type_resource_id = int;
	
	
	/**
	 */
	export type type_resource_object = (
		{
			kind : "local";
			data : {
				event_ids : Array<
					type_local_resource_event_id
				>;
			};
		}
		|
		{
			kind : "ics_feed";
			data : {
				url : string;
				from_fucked_up_wordpress : boolean;
			};
		}
	);
	
	
	/**
	 */
	export type type_calendar_id = int;
	
	
	/**
	 */
	export type type_calendar_object = {
		name : string;
		hue : float;
		access : {
			public : boolean;
			default_level : enum_access_level;
			attributed_group : lib_plankton.map.type_map<
				type_group_id,
				enum_access_level
			>;
			attributed_user : lib_plankton.map.type_map<
				type_user_id,
				enum_access_level
			>;
		};
		resource_id : type_resource_id;
	};

	
	/**
	 */
	export type type_event_hash = string;
	
	
	/**
	 */
	export type type_event_extended = {
		hash : type_event_hash;
		calendar_id : type_calendar_id;
		calendar_name : string;
		hue : float;
		access_level : enum_access_level;
		event_id : (null | type_local_resource_event_id);
		event_object : type_event_object;
	};
	
}
