import { BrowserModule } from '@angular/platform-browser';
import { DEFAULT_CURRENCY_CODE, LOCALE_ID, NgModule } from '@angular/core';
import ptBr from '@angular/common/locales/pt';
import { HashLocationStrategy, LocationStrategy } from '@angular/common';

import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { HttpClientModule } from '@angular/common/http';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { LottieModule } from 'ngx-lottie';
import player from 'lottie-web';

import { SalesModule } from './sales/sales.module';
import { FinancialModule } from './financial/financial.module';
import { StoreDevtoolsModule } from '@ngrx/store-devtools';
import { environment } from '../environments/environment';
import { EffectsModule } from '@ngrx/effects';
import { ShoppingEffects } from './sales/store/effects/shopping.effects';
import { StoreModule } from '@ngrx/store';
import { ShoppingReducer } from './sales/store/reducers/shopping.reducer';
import { AngularFireModule } from '@angular/fire';
import { AngularFirestoreModule } from '@angular/fire/firestore';
import { AngularFireAuthModule } from '@angular/fire/auth';
import { AuthGuard } from './guards/auth.guard';
import { AuthService } from './auth/services/auth.service';
import { CustomerModule } from './sales/customer/customer.module';
import { KendoModule } from './shared/kendo.module';
import { MessageErrorComponent } from './shared/menssages/message-error/message-error.component';
import { MenuEcosistemaComponent } from './menu-ecosistema/menu-ecosistema.component';
import { ComponentModule } from './components/component.module';
import { MessageFailureComponent } from './shared/menssages/message-failure/message-failure.component';
import { CustomerSaleEffects } from './sales/store/effects/customer-sale.effects';
import { CustomerSaleReducer } from './sales/store/reducers/customer-sale.reducer';
import { MenssageInformationComponent } from './shared/menssages/menssage-information/menssage-information.component';
import { CrmModule } from './crm/crm.module';
import { registerLocaleData } from '@angular/common';
import { MenuComponent } from './menu/menu.component';
import { MenuSalesComponent } from './sales/menu-sales/menu-sales.component';
import { StimulsoftViewerModule } from 'stimulsoft-viewer-angular';
import { DialogRef } from '@progress/kendo-angular-dialog';
import { PartnersModule } from './partners/partners.module';
import { AdminModule } from './admin/admin.module';
import { DialogsModule } from '@progress/kendo-angular-dialog';
import { ChartsModule } from '@progress/kendo-angular-charts';
import 'hammerjs';



registerLocaleData(ptBr);

export function playerFactory() {
  return player;
}

@NgModule({
  declarations: [
    AppComponent,
    MessageErrorComponent,
    MessageFailureComponent,
    MenuEcosistemaComponent,
    MenssageInformationComponent,
    MenuComponent,
    MenuSalesComponent,
  ],
  imports: [
    AngularFireModule.initializeApp(environment.firebase),
    DialogsModule,
    AngularFirestoreModule, // imports firebase/firestore, only needed for database features
    AngularFireAuthModule,
    BrowserModule,
    HttpClientModule,
    FinancialModule,
    AppRoutingModule,
    BrowserAnimationsModule,
    SalesModule,
    CustomerModule,
    KendoModule,
    ComponentModule,
    CrmModule,
    StoreModule.forRoot({ shopping: ShoppingReducer, customerSale: CustomerSaleReducer }),
    EffectsModule.forRoot([ShoppingEffects, CustomerSaleEffects]),
    StoreDevtoolsModule.instrument({ maxAge: 25, logOnly: environment.production }),
    StimulsoftViewerModule,
    PartnersModule,
    AdminModule,
  //  LottieModule.forRoot({ player: playerFactory }),
    ChartsModule,
  ],
  exports: [StimulsoftViewerModule],
  providers: [
    AuthGuard, AuthService,
    { provide: LocationStrategy, useClass: HashLocationStrategy },
    { provide: LOCALE_ID, useValue: 'pt-BR' },
    { provide: DEFAULT_CURRENCY_CODE, useValue: 'BRL', },
    DialogRef,
    /*{
      provide: ErrorHandler,
      useClass: ErrorsHandler,
    },*/
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }
