namespace _espe.api
{
	
	/**
	 */
	export function register_member_read(
		rest_subject : lib_plankton.rest.type_rest
	) : void
	{
		// todo: genauerer Ausgabe-Typ
		lib_plankton.rest.register<null, any>(
			rest_subject,
			lib_plankton.http.enum_method.get,
			"/member/:id",
			{
				"description": "gibt ein Mitglied anhand seiner ID aus",
				"output_schema": () => ({
					"nullable": false,
				}),
				"restriction": restriction_logged_in,
				"execution": async ({"path_parameters": path_parameters}) => {
					const member_id : _espe.service.member.type_id = parseInt(path_parameters["id"]);
					const member_value : _espe.service.member.type_value = await _espe.service.member.get(member_id);
					return Promise.resolve({
						"status_code": 200,
						"data": {
							"membership_number": member_value.membership_number,
							"enabled": member_value.enabled,
							"name_real_value": member_value.name_real_value,
							"name_real_extension": member_value.name_real_extension,
							"name_display": member_value.name_display,
							"name_login": member_value.name_login,
							"password_image": member_value.password_image,
							"email_address_private_value": member_value.email_address_private_value,
							"email_address_numberbased_use": member_value.email_address_numberbased_use,
							"email_address_namebased_use": member_value.email_address_namebased_use,
							"email_redirect_to_private": member_value.email_redirect_to_private,
							"salutation": member_value.salutation,
						},
					});
				}
			}
		);
	}
	
}
