<?php

namespace ControlScripts\Scopes;

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

class HallScope 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([
			"first_hall_buttons1" => ["mute" => [3]],
			"first_hall_buttons2" => [],
			"hall_secondary" => [],
			"btns_hall2_1" => [],
		]);
	}

	public function register_actions_scripts(): void {
		$this -> add_group_toggle_action("hall2_toggle", "Холл 2", [
			"light_hub_1:2",
		], [
			"description" => "Вкл/Выкл. свет в холле 2",
			"author" => "Eugene Sukhodolskiy",
			"state_callback" => function() {
				return $this -> helper() -> make_relay_indicator("light_hub_1", 2);
			},
		]);

		$this -> add_hatch_action("hatch_open", "Открыть люк", "kitchen_hatch", "open", 100, [
			"icon" => '<i class="ph ph-arrow-fat-line-up"></i>',
			"description" => "Открыть люк в подвал",
			"author" => "Eugene Sukhodolskiy",
			"danger_level" => "dangerous",
			"state_callback" => function() {
				return $this -> helper() -> make_hatch_indicator("kitchen_hatch");
			},
		]);

		$this -> add_hatch_action("hatch_close", "Закрыть люк", "kitchen_hatch", "close", 100, [
			"icon" => '<i class="ph ph-arrow-fat-line-down"></i>',
			"description" => "Закрыть люк в подвал",
			"author" => "Eugene Sukhodolskiy",
			"danger_level" => "dangerous",
			"state_callback" => function() {
				return $this -> helper() -> make_hatch_indicator("kitchen_hatch");
			},
		]);
	}

	public function register_regular_scripts(): void {}
}
