<?php
/** Authentifizierter Status-Endpunkt des wpagently-Kontrollzentrums. */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

function wpagent_companion_register_control_routes(): void {
	register_rest_route(
		'wp-agent/v1',
		'/status',
		array(
			'methods'             => 'GET',
			'permission_callback' => static fn() => current_user_can( 'edit_posts' ),
			'callback'            => static fn() => rest_ensure_response( wpagent_companion_control_public_status() ),
		)
	);
}
add_action( 'rest_api_init', 'wpagent_companion_register_control_routes' );
