
namespace _zeitbild.api
{
	
	/**
	 */
	export function register_caldav_sniff(
		rest_subject : lib_plankton.rest_caldav.type_rest
	) : void
	{
		register<
			any,
			null
		>(
			rest_subject,
			lib_plankton.caldav.enum_method.options,
			"/caldav",
			{
				"restriction": restriction_none,
				"execution": async (stuff) => {
					const permitted : boolean = await restriction_basic_auth(stuff);
					if (! permitted) {
						return Promise.resolve(
							{
								"status_code": 401,
								"data": null,
								"extra_headers": {
									"WWW-Authenticate": "Basic realm=Restricted",
								}
							}
						);
					}
					else {
						return Promise.resolve(
							{
								"status_code": 200,
								"data": null
							}
						);
					}
				}
			}
		);
	}
	
}
