import { Component, OnInit } from '@angular/core';

import { AppModulesService } from '../../app-modules.service';

import { AvailableAppModule } from '../../AppModulesTypes';
import { LinkifyService } from '../../linkify.service';

declare const $: any;
declare interface RouteInfo {
  path: string;
  title: string;
  icon: string;
  class: string;
}
export const ROUTES: RouteInfo[] = [
  {
    path: '/dashboard',
    title: 'Dashboard',
    icon: 'tachometer-alt',
    class: ''
  },
  {
    path: '/user-profile',
    title: 'User Profile',
    icon:'user-alt',
    class: ''
  },
  {
    path: '/authentication',
    title: 'Authentication',
    icon:'key',
    class: ''
  },
  {
    path: '/authorization',
    title: 'Authorization',
    icon:'shield-alt',
    class: ''
  },
  {
    path: '/feature-switches',
    title: 'Feature Switches',
    icon:'toggle-on',
    class: ''
  },
  {
    path: '/short-links',
    title: 'Short Links',
    icon:'link',
    class: ''
  },
  {
    path: '/email',
    title: 'Email',
    icon:'envelope',
    class: ''
  },
  // { path: '/table-list', title: 'Table List',  icon:'content_paste', class: '' },
  // { path: '/typography', title: 'Typography',  icon:'library_books', class: '' },
  // { path: '/icons', title: 'Icons',  icon:'bubble_chart', class: '' },
  // { path: '/maps', title: 'Maps',  icon:'location_on', class: '' },
  // { path: '/notifications', title: 'Notifications',  icon:'notifications', class: '' },
  // { path: '/upgrade', title: 'Upgrade to PRO',  icon:'unarchive', class: 'active-pro' },
];

@Component({
  selector: 'app-sidebar',
  templateUrl: './sidebar.component.html',
  styleUrls: ['./sidebar.component.css']
})
export class SidebarComponent implements OnInit {
  menuItems: any[];

  constructor(
    private appModulesService: AppModulesService,
    private linkify: LinkifyService,
  ) { }

  ngOnInit() {
    this.menuItems = ROUTES.filter(menuItem => menuItem);
    // let self = this;
    // this.appModulesService.getAvailableAppModules().subscribe((availableModules: AvailableAppModule[]) => {
    //   self.menuItems = availableModules.map((appModule: AvailableAppModule) => {
    //     return {
    //       path: this.linkify.transform(appModule.name),
    //       title: appModule.name,
    //       icon: "dashboard",
    //       class: "",
    //       label: ""
    //     };
    //   });
    //   // self.appModules = availableModules;
    // });
  }
  isMobileMenu() {
    if ($(window).width() > 991) {
      return false;
    }
    return true;
  };
}
