
namespace _zeitbild.api
{
	
	/**
	 */
	export function register_calendar_remove(
		rest_subject : lib_plankton.rest_caldav.type_rest
	) : void
	{
		register<
			null,
			null
		>(
			rest_subject,
			lib_plankton.http.enum_method.delete,
			"/calendar/:calendar_id",
			{
				"description": "löscht einen Kalender",
				"output_schema": () => ({
					"type": "null",
				}),
				"restriction": restriction_logged_in,
				"execution": async (stuff) => {
					const session : {key : string; value : lib_plankton.session.type_session;} = await session_from_stuff(stuff);
					const user_id : _zeitbild.type_user_id = await _zeitbild.service.user.identify(session.value.name);
					
					const calendar_id : _zeitbild.type_calendar_id = parseInt(stuff.path_parameters["calendar_id"]);
					await _zeitbild.service.calendar.remove(
						calendar_id,
						user_id
					);
					return Promise.resolve(
						{
							"status_code": 200,
							"data": null,
						}
					);
				}
			}
		);
	}
	
}
