<?php

namespace ControlScripts\Scopes;

use \SHServ\Middleware\ControlScripts;
use \SHServ\Implements\ControlScriptsInterface;

class OutdoorScope extends ControlScripts implements ControlScriptsInterface {
	use \ControlScripts\Common;

	public function register_sync_map(): void {
		$this -> register_global_device_sync_map();
	}

	public function register_events_handlers(): void {
		$this -> auto_button_bindings([
			"buttons_backdoor" => [],
			"master_door_btns" => [],
		]);
	}

	public function register_actions_scripts(): void {
		$this -> add_action_script([
			"alias" => "all_spotlights_off",
			"name" => "Все прожекторы выкл",
			"description" => "Выключить все прожекторы",
			"author" => "Eugene Sukhodolskiy",
		], function($params) {
			return $this -> group_set_state([
				"spotlight_main_back_1",
				"spotlight_main_back_2",
				"spotlight_main_front_1",
			], false);
		});

		$this -> add_off_action("front_spotlight_off", "Передний прожектор выкл", "spotlight_main_front_1", null, [
			"description" => "Выключить передний прожектор",
			"author" => "Eugene Sukhodolskiy",
		]);

		$this -> add_action_script([
			"alias" => "back_spotlights_off",
			"name" => "Задние прожекторы выкл",
			"description" => "Выключить задние прожекторы",
			"author" => "Eugene Sukhodolskiy",
		], function($params) {
			return $this -> group_set_state([
				"spotlight_main_back_1",
				"spotlight_main_back_2",
			], false);
		});
	}

	public function register_regular_scripts(): void {}
}
