<?php

namespace SHServ\Routes;

trait ScriptsRESTAPI_v1 {
	protected function scripts_restapi_uri_routes() {
		$this -> router -> uri("/api/v1/scripts/actions/list", "{$this -> cn}\\ScriptsRESTAPIController@actions_scripts_list");
		$this -> router -> uri("/api/v1/scripts/scopes/list", "{$this -> cn}\\ScriptsRESTAPIController@scope_list");
		$this -> router -> uri("/api/v1/scripts/regular/list", "{$this -> cn}\\ScriptsRESTAPIController@regular_scripts_list");
		$this -> router -> uri('/api/v1/scripts/scopes/name/$name', "{$this -> cn}\\ScriptsRESTAPIController@scope_file");

		$this -> router -> uri('/api/v1/scripts/actions/alias/$uniq_name/$state', "{$this -> cn}\\ScriptsRESTAPIController@set_action_script_state");
		$this -> router -> uri('/api/v1/scripts/scopes/name/$uniq_name/$state', "{$this -> cn}\\ScriptsRESTAPIController@set_scope_state");
		$this -> router -> uri('/api/v1/scripts/regular/alias/$uniq_name/$state', "{$this -> cn}\\ScriptsRESTAPIController@set_regular_script_state");
	}

	protected function scripts_restapi_post_routes() {
		$this -> router -> post(
			[ "alias", "params" ],
			"{$this -> cn}\\ScriptsRESTAPIController@run_action_script",
			'/api/v1/scripts/actions/run'
		);

		$this -> router -> post(
			[ "name", "path", "file" ],
			"{$this -> cn}\\ScriptsRESTAPIController@scope_update",
			'/api/v1/scripts/scopes/update'
		);

	}

	protected function scripts_restapi_get_routes() {
	
	}
}