/*
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.api
{
	
	/**
	 */
	export function make(
	) : lib_plankton.rest_http.type_rest
	{
		const rest_subject : lib_plankton.rest_http.type_rest = lib_plankton.rest_http.make(
			{
				"title": "zeitbild",
				"versioning_method": "header",
				"versioning_header_name": "X-Api-Version",
				"set_access_control_headers": true,
				"authentication": {
					"kind": "key_header",
					"data": {"name": "X-Session-Key"}
				},
			}
		);
		// meta
		{
			_zeitbild.api.register_meta_ping(rest_subject);
			_zeitbild.api.register_meta_spec(rest_subject);
		}
		// session
		{
			_zeitbild.api.register_session_prepare(rest_subject);
			_zeitbild.api.register_session_begin(rest_subject);
			_zeitbild.api.register_session_end(rest_subject);
			_zeitbild.api.register_session_oidc(rest_subject);
			_zeitbild.api.register_session_status(rest_subject);
		}
		// groups
		{
			_zeitbild.api.register_group_list(rest_subject);
		}
		// user
		{
			_zeitbild.api.register_users(rest_subject);
			// caldav
			{
				_zeitbild.api.register_user_dav_conf(rest_subject);
				_zeitbild.api.register_user_dav_token(rest_subject);
			}
		}
		// calendar
		{
			_zeitbild.api.register_calendar_list(rest_subject);
			_zeitbild.api.register_calendar_get(rest_subject);
			_zeitbild.api.register_calendar_add(rest_subject);
			_zeitbild.api.register_calendar_change(rest_subject);
			_zeitbild.api.register_calendar_remove(rest_subject);
			// event
			{
				_zeitbild.api.register_calendar_event_get(rest_subject);
				_zeitbild.api.register_calendar_event_add(rest_subject);
				_zeitbild.api.register_calendar_event_change(rest_subject);
				_zeitbild.api.register_calendar_event_remove(rest_subject);
			}
		}
		// export
		{
			_zeitbild.api.register_export_ics(rest_subject);
		}
		// misc
		{
			_zeitbild.api.register_events(rest_subject);
		}
		
		return rest_subject;
	}
	
}

