<?php

namespace SHServ\Routes;

trait AreasRESTAPI_v1 {
	protected function areas_restapi_uri_routes() {
		$this -> router -> uri('/api/v1/areas/id/$area_id/list', "{$this -> cn}\\AreasRESTAPIController@areas_list");
		$this -> router -> uri('/api/v1/areas/list', "{$this -> cn}\\AreasRESTAPIController@areas_list");
		$this -> router -> uri('/api/v1/areas/id/$area_id/remove', "{$this -> cn}\\AreasRESTAPIController@remove_area");
		$this -> router -> uri('/api/v1/areas/id/$area_id/reboot_devices', "{$this -> cn}\\AreasRESTAPIController@reboot_devices");
		$this -> router -> uri('/api/v1/areas/reboot_devices', "{$this -> cn}\\AreasRESTAPIController@reboot_devices");
		$this -> router -> uri('/api/v1/areas/id/$area_id/devices', "{$this -> cn}\\AreasRESTAPIController@devices_list");
		$this -> router -> uri('/api/v1/areas/id/$area_id/scripts', "{$this -> cn}\\AreasRESTAPIController@scripts_list");
		$this -> router -> uri('/api/v1/areas/types/list', "{$this -> cn}\\AreasRESTAPIController@exists_types");
		$this -> router -> uri('/api/v1/areas/id/$target_id/unassign-from-area', "{$this -> cn}\\AreasRESTAPIController@unassign_from_area");
	}

	protected function areas_restapi_post_routes() {
		$this -> router -> post(
			[ "type", "alias", "display_name" ],
			"{$this -> cn}\\AreasRESTAPIController@new_area",
			"/api/v1/areas/new-area"
		);

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

		$this -> router -> post(
			[ "area_id", "display_name" ],
			"{$this -> cn}\\AreasRESTAPIController@update_display_name",
			"/api/v1/areas/update-display-name"
		);

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

	protected function areas_restapi_get_routes() {
	
	}
}