/*
 * Copyright (C) 2018-2021 StApps
 * This program is free software: you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the Free
 * Software Foundation, version 3.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program. If not, see <https://www.gnu.org/licenses/>.
 */
import {ScrollingModule} from '@angular/cdk/scrolling';
import {CommonModule} from '@angular/common';
import {HttpClientModule} from '@angular/common/http';
import {NgModule} from '@angular/core';
import {FormsModule} from '@angular/forms';
import {Network} from '@ionic-native/network/ngx';
import {IonicModule} from '@ionic/angular';
import {TranslateModule} from '@ngx-translate/core';
import {MarkdownModule} from 'ngx-markdown';
import {MomentModule} from 'ngx-moment';
import {ThingTranslateModule} from '../../translation/thing-translate.module';
import {MenuModule} from '../menu/menu.module';
import {StorageModule} from '../storage/storage.module';
import {HebisDetailComponent} from './hebis-detail/hebis-detail.component';
import {HebisDetailContentComponent} from './hebis-detail/hebis-detail-content.component';
import {HebisSearchPageComponent} from './list/hebis-search-page.component';
import {HebisDataProvider} from './hebis-data.provider';
import {DaiaDataProvider} from './daia-data.provider';
import {StAppsWebHttpClient} from '../data/stapps-web-http-client.provider';
import {HebisRoutingModule} from './hebis-routing.module';
import {DataModule} from '../data/data.module';

import {BookDetailContentComponent} from './types/book/book-detail-content.component';
import {BookListItemComponent} from './types/book/book-list-item.component';

import {PeriodicalListItemComponent} from './types/periodical/periodical-list-item.component';
import {PeriodicalDetailContentComponent} from './types/periodical/periodical-detail-content.component';
import {HebisArticleListItemComponent} from './types/hebis-article/hebis-article-item.component';
import {HebisArticleContentComponent} from './types/hebis-article/hebis-article-content.component';
import {DataListComponent} from '../data/list/data-list.component';
import {DaiaAvailabilityComponent} from './daia-availability/daia-availability.component';

/**
 * Module for handling data
 */
@NgModule({
  declarations: [
    HebisSearchPageComponent,
    HebisDetailComponent,
    HebisDetailContentComponent,
    DaiaAvailabilityComponent,
    BookDetailContentComponent,
    BookListItemComponent,
    PeriodicalDetailContentComponent,
    PeriodicalListItemComponent,
    HebisArticleListItemComponent,
    HebisArticleContentComponent,
  ],
  entryComponents: [DataListComponent],
  imports: [
    CommonModule,
    DataModule,
    FormsModule,
    HebisRoutingModule,
    HttpClientModule,
    IonicModule.forRoot(),
    MarkdownModule.forRoot(),
    MenuModule,
    MomentModule.forRoot({
      relativeTimeThresholdOptions: {
        m: 59,
      },
    }),
    ScrollingModule,
    StorageModule,
    TranslateModule.forChild(),
    ThingTranslateModule.forChild(),
  ],
  providers: [
    HebisDataProvider,
    DaiaDataProvider,
    Network,
    StAppsWebHttpClient,
  ],
  exports: [
    HebisSearchPageComponent,
    HebisDetailComponent,
    HebisDetailContentComponent,
    DaiaAvailabilityComponent,
    PeriodicalDetailContentComponent,
    BookDetailContentComponent,
    HebisArticleListItemComponent,
    HebisArticleContentComponent,
  ],
})
export class HebisModule {}
