import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {FormsModule} from '@angular/forms';
import {IonicModule} from '@ionic/angular';
import {RouterModule, Routes} from '@angular/router';
import {TranslateModule} from '@ngx-translate/core';
import {LibraryAccountPageComponent} from './account/account.page';
import {AuthRoutes} from '../auth/auth-routes';
import {ProfilePageComponent} from './account/profile/profile-page.component';
import {CheckedOutPageComponent} from './account/checked-out/checked-out-page.component';
import {HoldsAndReservationsPageComponent} from './account/holds-and-reservations/holds-and-reservations-page.component';
import {FinesPageComponent} from './account/fines/fines-page.component';
import {PAIAItemComponent} from './account/elements/paia-item/paiaitem.component';
import {FirstLastNamePipe} from './account/first-last-name.pipe';
import {AuthGuardService} from '../auth/auth-guard.service';

const routes: AuthRoutes | Routes = [
  {
    path: 'library-account',
    component: LibraryAccountPageComponent,
    data: {authProvider: 'paia'},
    canActivate: [AuthGuardService],
  },
  {path: 'library-account/profile', component: ProfilePageComponent},
  {path: 'library-account/checked-out', component: CheckedOutPageComponent},
  {
    path: 'library-account/holds-and-reservations',
    component: HoldsAndReservationsPageComponent,
  },
  {path: 'library-account/fines', component: FinesPageComponent},
];

@NgModule({
  imports: [
    CommonModule,
    FormsModule,
    IonicModule,
    RouterModule.forChild(routes),
    TranslateModule,
  ],
  declarations: [
    LibraryAccountPageComponent,
    ProfilePageComponent,
    CheckedOutPageComponent,
    HoldsAndReservationsPageComponent,
    FinesPageComponent,
    PAIAItemComponent,
    FirstLastNamePipe,
  ],
})
export class LibraryModule {}
