import { Routes } from '@angular/router';

import { DashboardComponent } from '../../components/dashboard/dashboard.component';
import { ProfileComponent } from '../../components/profile/profile.component';
import { AssetsComponent } from '@app/components/assets/assets.component';
import { PlantsComponent } from '@app/components/plants/plants.component';

import { OrganizationsComponent } from '@app/components/organizations/organizations.component';
import { OrganizationComponent } from '@app/components/organizations/organization/organization.component';
import { NewOrganizationComponent } from '@app/components/organizations/new-organization/new-organization.component';
import { EditOrganizationComponent } from '@app/components/organizations/edit-organization/edit-organization.component';
import { EditPlantComponent } from '@app/components/plants/edit-plant/edit-plant.component';
import { NewPlantComponent } from '@app/components/plants/new-plant/new-plant.component';
import { UsersComponent } from '@app/components/users/users.component';
import { NewUserComponent } from '@app/components/users/new-user/new-user.component';
import { AuthGuard } from '@app/services/auth.guard';


export const AdminLayoutRoutes: Routes = [
  { path: 'dashboard',
    component: DashboardComponent,
    data: {title: "Dashboard"}
  },
  { path: 'profile',
    component: ProfileComponent,
    data: {title: "Perfil de usuario"}
  },
  { path: 'assets', 
    component: AssetsComponent,
    data: {title: "Listado de plantas"}
  },
  // General management
  { path: 'plants', 
    component: PlantsComponent,
    canActivate: [AuthGuard], 
    data: {
      title: "Listado de plantas",
      breadcrumb: "Plantas",
      roles: [2,3]
    },
  },
  { path: 'plants/new', 
    component: NewPlantComponent,
    canActivate: [AuthGuard], 
    data: {
      title: "Nueva planta",
      breadcrumb: "Nueva planta",
      roles: [3]
    },
  },
  { path: 'plant/:id/edit', 
    component: EditPlantComponent,
    canActivate: [AuthGuard], 
    data: {
      title: "Editar planta",
      breadcrumb: "Editar planta",
      roles: [2,3]
    },
  },
  
  { path: 'users', 
    component: UsersComponent,
    canActivate: [AuthGuard], 
    data: {
      title: "Listado de usuarios",
      breadcrumb: "Usuarios",
      roles: [3]
    },
  },
    
  { path: 'users/new', 
    component: NewUserComponent,
    canActivate: [AuthGuard], 
    data: {
      title: "Nuevo usuario",
      breadcrumb: "Nuevo usuario",
      roles: [3]
    },
  },

  // Organizations actions
  { path: 'organizations', 
    component: OrganizationsComponent,
    canActivate: [AuthGuard], 
    data: {
      title: "Listado de organizaciones",
      breadcrumb: "Organizaciones",
      roles: [2,3]
    },
  },
  {
    path: 'organizations/new',
    component: NewOrganizationComponent,
    canActivate: [AuthGuard], 
    data: {
      title: 'Nueva organización',
      breadcrumb:'Nueva organización',
      roles: [3]
    }
  },
  {
    path: 'organization/:id',
    component: OrganizationComponent,
    canActivate: [AuthGuard], 
    data: {
      title: 'Organización',
      breadcrumb: 'Detalle',
      roles: [2,3]
    }
  },
  {
    path: 'organization/:id/edit',
    canActivate: [AuthGuard], 
    component: EditOrganizationComponent,
    data: {
      title: 'Editar organización',
      breadcrumb: 'Editar organización',
      roles: [3]
    }
  },

];
