namespace _espe.api
{
	
	/**
	 */
	export function register_member_list(
		rest_subject : lib_plankton.rest.type_rest
	) : void
	{
		// TODO: translate types
		lib_plankton.rest.register<null, Array<{id : _espe.service.member.type_id; preview : {};}>>(
			rest_subject,
			lib_plankton.http.enum_method.get,
			"/member",
			{
				"description": "listet alle Mitglieder auf",
				"restriction": restriction_logged_in,
				"output_schema": () => ({
					"type": "array",
					"items": {
						"type": "object",
						"nullable": false,
						"additionalProperties": false,
						"properties": {
							"id": {
								"type": "integer",
								"nullable": false,
							},
							"preview": {
								"type": "object",
								"additionalProperties": false,
								"properties": {
									"name": {
										"type": "string",
										"nullable": false,
									},
								},
								"required": [
									"name",
								]
							}
						},
						"required": [
							"id",
							"preview",
						],
					}
				}),
				"execution": async ({}) => {
					return Promise.resolve({
						"status_code": 200,
						"data": (await _espe.service.member.list()),
					});
				}
			}
		);
	}
	
}
