function sidebarTemplate(active) {
	return Helper.template.sidebarNav([
		{
			content: `<span class="list-label"><i class="ph ph-cpu"></i> Devices</span>`,
			route: "/#!/devices",
			is_active: active == "devices"
		},
		{
			content: `<span class="list-label"><i class="ph ph-magnifying-glass"></i> Scanning</span>`,
			route: "/#!/devices/scanning",
			is_active: active == "scanning"
		}
	]);
}

function rebootDeviceBtnHandler(sh_api, btn, modal) {
	Helper.states.btnLoadingState(btn, true);

	const deviceId = btn.dataset.deviceId;
	const deviceName = btn.dataset.deviceName;
	const deviceAlias = btn.dataset.deviceAlias;
	
	sh_api.devices.reboot(
		deviceId,
		(err, data, meta) => {
			Helper.states.btnLoadingState(btn, false);
			console.log("Reboot done", err, data, meta);

			modal?.close();

			if(data) {
				setTimeout(() => Screens.reinit(), 8000);
				Toasts.createSuccess(
					"Reboot successful",
					`Device: ${deviceName}<br>
					Alias: <b>${deviceAlias}</b>`
				).show();
			} else {
				Toasts.createError(
					"Reboot failed",
					`Device: ${deviceName}<br>
					Alias: <b>${deviceAlias}</b>`
				).show();
			}
		}
	);
}

export {
	sidebarTemplate,
	rebootDeviceBtnHandler
}