// angular modules
import { NgModule, APP_INITIALIZER, ModuleWithProviders, Injector, Optional, SkipSelf,InjectionToken } from '@angular/core';
import { CommonModule, DatePipe } from '@angular/common';
import { HttpClientModule, HttpClient, HTTP_INTERCEPTORS } from '@angular/common/http';
import { FormsModule } from '@angular/forms';

// external modules
import { OAuthModule, AuthConfig, OAuthService, OAuthStorage } from 'angular-oauth2-oidc';
import { StoreModule, Store } from '@ngrx/store';
import { EffectsModule } from '@ngrx/effects';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import { UploadxModule } from 'ngx-uploadx';
import { ClipboardModule } from 'ngx-clipboard';


// routing module
import { AppCommonRoutingModule } from './common-routing.module';

import { MODULE_NAME } from './module-name';

//components
import { SafePipe } from './shared/safe.pipe';
import { AuthConfigFactory, IAuthconfigFactory } from './shared/authconfigFactory';
import { AppComponent } from './components/app/app.component';
import { AuthCallbackComponent } from './components/auth-callback/auth-callback.component';
import { SessionClearedComponent } from './components/session-cleared/session-cleared.component';
import { ResumableFileUploadComponent } from './components/resumable-file-upload/resumable-file-upload.component';
import { NotFoundComponent } from './components/not-found/not-found.component';
import { NotImplementedComponent } from './components/not-implemented/not-implemented.component';
import { SidePanelComponent } from './components/side-panel/side-panel.component';
import { TimespanComponent } from './components/timespan/timespan.component';
import { TagInputComponent } from './components/tag-input/tag-input.component';
import { MenuBackgroundComponent } from './components/menu-background/menu-background.component';
import { HasPackageDirective} from './components/has-package/has-package.directive';
import { PackageExistsDirective} from './components/package-exists/package-exists.directive';
import { HasClaimDirective} from './components/has-claim/has-claim.directive';
import { UserMenuComponent} from './components/user-menu/user-menu.component';
import { ThumbnailComponent } from './components/thumbnail/thumbnail.component';
import { Alert } from './enumerations/alert.enum';
import { IEventMessage } from './models/event.message';
import { IItem, Item } from './models/item';
import { WeatherCurrentObservation } from './models/weatherCurrentObservation';
import { IItemType } from './models/item.type';
import { IItemTypes } from './models/item.types';
import { IItemTask, ItemTask } from './models/itemTask';
import { IListItem } from './models/list.item';
import { ITypeaheadItem } from './models/typeahead.item'
import { IJsonline } from './models/json-line';
import { ISenMLItem } from './models/senml-item';
import { IPackage,IPackages } from './models/package';
import { IUser } from './models/user';
import { IQueryState } from './models/query.state';
import { IDataLayer } from './models/data.layer';
import { IColor,IGradientstop} from './models/gradient';
import * as commonActions from './actions/app-common.actions';
import * as commonReducers from './reducers/app-common.reducer';
import * as commonEffects from './effects/app-common.effects';
import { SecureOAuthStorage} from './shared/secureOAuthStorage';
import { GradientComponent } from './components/gradient/gradient.component';
import { GradientSelectComponent } from './components/gradient-select/gradient-select.component';
import { AppMenuComponent } from './components/app-menu/app-menu.component';
import { NotificationMenuComponent} from './components/notification-menu/notification-menu.component';
import { HelpMenuComponent} from './components/help-menu/help-menu.component';
import { BackButtonComponent } from './components/back-button/back-button.component';
import { EditImageModalComponent } from './components/edit-image-modal/edit-image-modal.component';
import { AvatarComponent } from './components/avatar/avatar.component';
import { AvatarModule } from 'ngx-avatar';
import { ImageCropperModule } from 'ngx-image-cropper';

export const FM_COMMON_STARTPAGE = new InjectionToken<string>('fm-common-startpage');

export {
  SafePipe,
  AuthCallbackComponent,
  AppComponent,
  SessionClearedComponent,
  ResumableFileUploadComponent,
  NotFoundComponent,
  NotImplementedComponent,
  SidePanelComponent,
  TimespanComponent,
  TagInputComponent,
  UserMenuComponent,
  ThumbnailComponent,
  HasPackageDirective,
  PackageExistsDirective,
  HasClaimDirective,
  Alert,
  IEventMessage,
  IItem,
  Item,
  IItemType,
  IItemTypes,
  IItemTask,
  ItemTask,
  IListItem,
  ITypeaheadItem,
  IUser,
  IQueryState,
  IPackage,
  IPackages,
  commonActions,
  commonReducers,
  IAuthconfigFactory,
  AuthConfigFactory,
  MenuBackgroundComponent,
  SecureOAuthStorage,
  WeatherCurrentObservation,
  IJsonline,
  ISenMLItem,
  IDataLayer,
  IColor,
  IGradientstop,
  BackButtonComponent,
  AvatarComponent,
  EditImageModalComponent,
  GradientComponent,
  GradientSelectComponent
};

@NgModule({
  imports: [
    CommonModule,
    HttpClientModule,
    AppCommonRoutingModule,
    StoreModule.forFeature(MODULE_NAME, commonReducers.reducer),
    EffectsModule.forFeature([commonEffects.AppCommonEffects]),
    OAuthModule.forRoot(),
    NgbModule,
    FormsModule,
    UploadxModule,
    ClipboardModule,
    AvatarModule,
    ImageCropperModule
  ],
  declarations: [
    AppComponent,
    AuthCallbackComponent,
    SidePanelComponent,
    SafePipe,
    NotFoundComponent,
    NotImplementedComponent,
    ResumableFileUploadComponent,
    TimespanComponent,
    TagInputComponent,
    SessionClearedComponent,
    MenuBackgroundComponent,
    HasPackageDirective,
    PackageExistsDirective,
    HasClaimDirective,
    UserMenuComponent,
    GradientComponent,
    GradientSelectComponent,
    AppMenuComponent,
    NotificationMenuComponent,
    HelpMenuComponent,
    BackButtonComponent,
    ThumbnailComponent,
    EditImageModalComponent,
    AvatarComponent
  ],
  exports: [
    NgbModule,
    UploadxModule,
    ClipboardModule,
    CommonModule,
    AppComponent,
    ResumableFileUploadComponent,
    AuthCallbackComponent,
    SidePanelComponent,
    SafePipe,
    NotFoundComponent,
    NotImplementedComponent,
    ResumableFileUploadComponent,
    TimespanComponent,
    TagInputComponent,
    SessionClearedComponent,
    MenuBackgroundComponent,
    HasPackageDirective,
    PackageExistsDirective,
    HasClaimDirective,
    UserMenuComponent,
    GradientComponent,
    GradientSelectComponent,
    BackButtonComponent,
    ThumbnailComponent,
    AvatarComponent,
    EditImageModalComponent
  ]
})
export class AppCommonModule {
}
