<?php

namespace SHServ\Routes;

trait DevicesRESTAPI_v1 {
	protected function devices_restapi_uri_routes() {
		$this -> router -> uri("/api/v1/devices/scanning/setup", "{$this -> cn}\\DevicesRESTAPIController@scanning__ready_to_setup");
		$this -> router -> uri("/api/v1/devices/scanning/all", "{$this -> cn}\\DevicesRESTAPIController@scanning__all");

		$this -> router -> uri('/api/v1/devices/id/$device_id/reboot', "{$this -> cn}\\DevicesRESTAPIController@reboot_device");
		$this -> router -> uri('/api/v1/devices/id/$device_id/remove', "{$this -> cn}\\DevicesRESTAPIController@remove_device");
		$this -> router -> uri('/api/v1/devices/id/$device_id/info', "{$this -> cn}\\DevicesRESTAPIController@device_info");
		$this -> router -> uri('/api/v1/devices/id/$device_id', "{$this -> cn}\\DevicesRESTAPIController@device");
		$this -> router -> uri('/api/v1/devices/id/$device_id/status', "{$this -> cn}\\DevicesRESTAPIController@device_status");
		$this -> router -> uri('/api/v1/devices/id/$target_id/unassign-from-area', "{$this -> cn}\\DevicesRESTAPIController@unassign_from_area");
		$this -> router -> uri('/api/v1/devices/list', "{$this -> cn}\\DevicesRESTAPIController@devices_list");
	}

	protected function devices_restapi_post_routes() {
		$this -> router -> post(
			[ "device_ip", "alias", "name", "description" ],
			"{$this -> cn}\\DevicesRESTAPIController@setup_new_device",
			"/api/v1/devices/setup/new-device"
		);

		$this -> router -> post(
			[ "device_id", "action", "params" ],
			"{$this -> cn}\\DevicesRESTAPIController@do_device_action",
			"/api/v1/devices/action"
		);

		$this -> router -> post(
			[ "target_id", "place_in_area_id" ],
			"{$this -> cn}\\DevicesRESTAPIController@place_in_area",
			"/api/v1/devices/place-in-area"
		);

		$this -> router -> post(
			[ "device_id", "name" ],
			"{$this -> cn}\\DevicesRESTAPIController@update_name",
			"/api/v1/devices/update-name"
		);

		$this -> router -> post(
			[ "device_id", "description" ],
			"{$this -> cn}\\DevicesRESTAPIController@update_description",
			"/api/v1/devices/update-description"
		);

		$this -> router -> post(
			[ "device_id", "new_alias" ],
			"{$this -> cn}\\DevicesRESTAPIController@update_alias",
			"/api/v1/devices/update-alias"
		);

		$this -> router -> post(
			[ "device_id" ],
			"{$this -> cn}\\DevicesRESTAPIController@resetup_device",
			"/api/v1/devices/resetup"
		);

		$this -> router -> post(
			[ "device_id" ],
			"{$this -> cn}\\DevicesRESTAPIController@reset_device",
			"/api/v1/devices/reset"
		);
	}

	protected function devices_restapi_get_routes() {
	
	}
}