
namespace _zeitbild.api
{
	
	/**
	 */
	export function date_type(
		options : {
			nullable ?: boolean;
		} = {}
	) : lib_plankton.rest_caldav.type_oas_schema
	{
		options = Object.assign(
			{
				"nullable": false,
			},
			options
		);
		return {
			"nullable": options.nullable,
			"type": "object",
			"properties": {
				"year": {
					"nullable": false,
					"type": "integer"
				},
				"month": {
					"nullable": false,
					"type": "integer"
				},
				"day": {
					"nullable": false,
					"type": "integer"
				},
			},
			"required": [
				"year",
				"month",
				"day"
			],
			"additionalProperties": false
		};
	}
	
	
	/**
	 */
	export function time_type(
		options : {
			nullable ?: boolean;
		} = {}
	) : lib_plankton.rest_caldav.type_oas_schema
	{
		options = Object.assign(
			{
				"nullable": false,
			},
			options
		);
		return {
			"nullable": options.nullable,
			"type": "object",
			"properties": {
				"hour": {
					"nullable": false,
					"type": "integer"
				},
				"minute": {
					"nullable": false,
					"type": "integer"
				},
				"second": {
					"nullable": false,
					"type": "integer"
				},
			},
			"required": [
				"hour",
				"minute",
				"second"
			],
			"additionalProperties": false
		};
	}
	
	
	/**
	 */
	export function datetime_type(
		options : {
			nullable ?: boolean;
		} = {}
	) : lib_plankton.rest_caldav.type_oas_schema
	{
		options = Object.assign(
			{
				"nullable": false,
			},
			options
		);
		return {
			"nullable": options.nullable,
			"type": "object",
			"properties": {
				"timezone_shift": {
					"nullable": false,
					"type": "integer"
				},
				"date": date_type({"nullable": false}),
				"time": time_type({"nullable": true}),
			},
			"required": [
			],
			"additionalProperties": false
		};
	}
	
	
	
	/**
	 */
	export function access_level_encode(
		access_level : _zeitbild.enum_access_level
	) : string
	{
		switch (access_level) {
			case _zeitbild.enum_access_level.none: {return "none";}
			case _zeitbild.enum_access_level.view: {return "view";}
			case _zeitbild.enum_access_level.edit: {return "edit";}
			case _zeitbild.enum_access_level.admin: {return "admin";}
			default: {throw (new Error("invalid access level: " + String(access_level)));}
		}
	}
	
	
	/**
	 */
	export function access_level_decode(
		access_level_ : string
	) : _zeitbild.enum_access_level
	{
		switch (access_level_) {
			case "none": {return _zeitbild.enum_access_level.none;}
			case "view": {return _zeitbild.enum_access_level.view;}
			case "edit": {return _zeitbild.enum_access_level.edit;}
			case "admin": {return _zeitbild.enum_access_level.admin;}
			default: {throw (new Error("invalid encoded access level: " + String(access_level_)));}
		}
	}
	
}

