import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { HomeComponent } from './components/home/home.component';
import { LoginComponent } from './components/login/login.component';
import { NotFoundComponent } from './components/not-found/not-found.component';
import { AccountComponent } from './components/home/workspace/account/account.component';
import { ParametresComponent } from './components/home/workspace/parametres/parametres.component';
import { DatetimeComponent } from './components/home/workspace/datetime/datetime.component';
import { InfosComponent } from './components/home/workspace/infos/infos.component';
import { HoursComponent } from './components/home/workspace/hours/hours.component';
import { LogsComponent } from './components/home/workspace/logs/logs.component';

import { ProfileService } from './services/profile/profile.service';

const routes: Routes = [
	{
		path:"login",
		component:LoginComponent
	},
	{
		path:"",
		component:HomeComponent,
		children: [
			{
				path:"account",
				component:AccountComponent
			},
			{
				path:"parameters",
				component:ParametresComponent
			},
			{
				path:"datetime",
				component:DatetimeComponent
			},
			{
				path:"infos",
				component:InfosComponent
			},
			{
				path:"hours",
				component:HoursComponent
			},
			{
				path:"logs",
				component:LogsComponent
			}
		],
		canActivate: [ProfileService]
	},
	{
		path:"not-found",
		component:NotFoundComponent
	},
	{
		path:"**",
		redirectTo:'/not-found'
	}
];

@NgModule({
	imports: [
		//RouterModule.forRoot(routes, { relativeLinkResolution: 'legacy' })
		RouterModule.forRoot(routes)
	],
	exports: [
		RouterModule
	]
})
export class AppRoutingModule { }
