import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { LoginComponent } from './login/login.component';
import { HomepageComponent } from './homepage/homepage.component';
import { SdkDashboardComponent } from './sdk-dashboard/sdk-dashboard.component';
import { CallComponent } from './sdk-dashboard/call/call.component';
import { DeviceComponent } from './sdk-dashboard/device/device.component';
import { LogoutComponent } from './sdk-dashboard/logout/logout.component';
import { SearchComponent } from './sdk-dashboard/search/search.component';
import { ProfileComponent } from './sdk-dashboard/profile/profile.component';
import { CallHistory } from './sdk-dashboard/call-history/call-history.component';
import { CallChannelStatus } from './sdk-dashboard/call-channel-status/call-channel-status.component';
import { AuthGuard } from './auth.guard';

export const routes: Routes = [
  { path: '', component: HomepageComponent },
  { path: 'login', component: LoginComponent },
  {
    path: 'dashboard',
    component: SdkDashboardComponent,
    canActivate: [AuthGuard],
  },
  { path: 'call', component: CallComponent, canActivate: [AuthGuard] },
  { path: 'device', component: DeviceComponent, canActivate: [AuthGuard] },
  { path: 'logout', component: LogoutComponent },
  { path: 'search', component: SearchComponent, canActivate: [AuthGuard] },
  { path: 'profile', component: ProfileComponent, canActivate: [AuthGuard] },
  { path: 'call-history', component: CallHistory, canActivate: [AuthGuard] },
  {
    path: 'call-channel-status',
    component: CallChannelStatus,
    canActivate: [AuthGuard],
  },
  { path: '**', redirectTo: '/login' },
];

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