
/**
 */
namespace _zeitbild.value_object.access_level
{
	
	/**
	 */
	export function to_string(
		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 from_string(
		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_)));}
		}
	}
	
	
	/**
	 */
	export function order(
		x : _zeitbild.enum_access_level,
		y : _zeitbild.enum_access_level
	) : boolean
	{
		const list : Array<_zeitbild.enum_access_level> = [
			_zeitbild.enum_access_level.none,
			_zeitbild.enum_access_level.view,
			_zeitbild.enum_access_level.edit,
			_zeitbild.enum_access_level.admin,
		];
		return (list.indexOf(x) <= list.indexOf(y));
	}
	
}
