<?php

namespace ControlScripts;

trait Common {
	public function register_global_device_sync_map() {
		$this -> add_sync_connection([
			["type" => "relay", "alias" => "spotlight_main_back_1", "channel" => 0],
			["type" => "button", "alias" => "buttons_backdoor", "channel" => 2],
			["type" => "button", "alias" => "master_door_btns", "channel" => 1],
			["type" => "button", "alias" => "bed_btns_left", "channel" => 0],
		]);

		$this -> add_sync_connection([
			["type" => "relay", "alias" => "spotlight_main_back_2", "channel" => 0],
			["type" => "button", "alias" => "buttons_backdoor", "channel" => 1],
			["type" => "button", "alias" => "master_door_btns", "channel" => 0],
		]);

		$this -> add_sync_connection([
			["type" => "relay", "alias" => "spotlight_main_front_1", "channel" => 0],
			["type" => "button", "alias" => "buttons_backdoor", "channel" => 0],
			["type" => "button", "alias" => "master_door_btns", "channel" => 3],
		]);

		$this -> add_sync_connection([
			["type" => "relay", "alias" => "light_hub_1", "channel" => 0],
			["type" => "button", "alias" => "buttons_office_room", "channel" => 3],
		]);

		$this -> add_sync_connection([
			["type" => "relay", "alias" => "craft_table_lamp", "channel" => 0],
			["type" => "button", "alias" => "buttons_office_room", "channel" => 2],
		]);

		$this -> add_sync_connection([
			["type" => "relay", "alias" => "computer_table_lamp", "channel" => 0],
			["type" => "button", "alias" => "buttons_office_room", "channel" => 1],
		]);

		$this -> add_sync_connection([
			["type" => "relay", "alias" => "light_hub_1", "channel" => 2],
			["type" => "button", "alias" => "buttons_office_room", "channel" => 0],
			["type" => "button", "alias" => "master_room_btns", "channel" => 1],
			["type" => "button", "alias" => "btns_hall2_1", "channel" => 0],
			["type" => "button", "alias" => "hall_secondary", "channel" => 0],
			["type" => "button", "alias" => "bed_btns_right_1", "channel" => 0],
		]);

		$this -> add_sync_connection([
			["type" => "relay", "alias" => "light_hub_1", "channel" => 1],
			["type" => "button", "alias" => "master_room_btns", "channel" => 0],
			["type" => "button", "alias" => "bed_btns_right_1", "channel" => 1],
			["type" => "button", "alias" => "bed_btns_left", "channel" => 1],
		]);

		$this -> add_sync_connection([
			["type" => "relay", "alias" => "bathroom_2_light", "channel" => 0],
			["type" => "button", "alias" => "hall_secondary", "channel" => 1],
		]);

		// 14 - down, 12 - left, 13 - top, 15 - right
		// 3 - top
		// 14->1 12->3 13->0
		$this -> add_sync_connection([
			["type" => "relay", "alias" => "plants_room_light", "channel" => 0],
			["type" => "button", "alias" => "plants_room_btns", "channel" => 3],
		]);

		$this -> add_sync_connection([
			["type" => "relay", "alias" => "italy_lamp_relay", "channel" => 0],
			["type" => "button", "alias" => "plants_room_btns", "channel" => 2],
		]);

		$this -> add_sync_connection([
			["type" => "relay", "alias" => "floor_lamp_relay", "channel" => 0],
			["type" => "button", "alias" => "plants_room_btns", "channel" => 0],
		]);

		$this -> add_sync_connection([
			["type" => "relay", "alias" => "server_room_light", "channel" => 0],
			["type" => "button", "alias" => "btns_hall2_1", "channel" => 1],
		]);




		// ---

		$this -> add_sync_connection([
			["type" => "relay", "alias" => "fisrt_floor_big_relay", "channel" => 0],
			["type" => "button", "alias" => "kitchen_buttons_11", "channel" => 0],
			["type" => "button", "alias" => "kitchen_buttons_2", "channel" => 0],
		]);

		$this -> add_sync_connection([
			["type" => "relay", "alias" => "fisrt_floor_big_relay", "channel" => 1],
			["type" => "button", "alias" => "kitchen_buttons_11", "channel" => 1],
			["type" => "button", "alias" => "kitchen_buttons_2", "channel" => 1],
		]);

		// ---

		$this -> add_sync_connection([
			["type" => "relay", "alias" => "fisrt_floor_big_relay", "channel" => 2],
			["type" => "button", "alias" => "first_hall_buttons1", "channel" => 0],
		]);

		$this -> add_sync_connection([
			["type" => "relay", "alias" => "fisrt_floor_big_relay", "channel" => 3],
			["type" => "button", "alias" => "first_hall_buttons1", "channel" => 1],
			["type" => "button", "alias" => "first_hall_buttons2", "channel" => 0],
		]);

		$this -> add_sync_connection([
			["type" => "relay", "alias" => "fisrt_floor_big_relay", "channel" => 4],
			["type" => "button", "alias" => "first_hall_buttons1", "channel" => 2],
			["type" => "button", "alias" => "first_hall_buttons2", "channel" => 1],
		]);

	}
}
