import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { AppCommonModule } from '@app/shared/common/app-common.module';
import { UtilsModule } from '@shared/utils/utils.module';
import { CountoModule } from 'angular2-counto';
import { ModalModule, TabsModule, TooltipModule, BsDropdownModule, PopoverModule, BsModalRef } from 'ngx-bootstrap';
import { DashboardComponent } from './dashboard/dashboard.component';
import { MainRoutingModule } from './main-routing.module';
import { NgxChartsModule } from '@swimlane/ngx-charts';

import { BsDatepickerModule, BsDatepickerConfig, BsDaterangepickerConfig, BsLocaleService } from 'ngx-bootstrap/datepicker';
import { NgxBootstrapDatePickerConfigService } from 'assets/ngx-bootstrap/ngx-bootstrap-datepicker-config.service';
import { FlyOutComponent } from '@app/shared/layout/flyout/flyout.component';
import { MapComponent } from '@app/shared/layout/map/map.component';
import { AgmCoreModule } from '@agm/core';
import { FlyOutLocationModalComponent } from '@app/shared/layout/flyout/location/location-modal.component';
import { FlyOutPackageTypeModalComponent } from '@app/shared/layout/flyout/package-type/package-type-modal.component';
import { FlyOutFleetModalComponent } from '@app/shared/layout/flyout/fleet/fleet-modal.component';
import { FlyOutContactsModalComponent } from '@app/shared/layout/flyout/contacts/contacts-modal.component';
import { AddressFormComponent } from '@app/shared/layout/form/address-form.component';
import { ContactFormComponent } from '@app/shared/layout/form/contact.form.component';
import { FlyOutDriverModalComponent } from '@app/shared/layout/flyout/driver/driver-modal.component';
import { ContactFormMainComponent } from '@app/shared/layout/formMain/contact.form.component';
import { AddressFormMainComponent } from '@app/shared/layout/formMain/address-form.component';


NgxBootstrapDatePickerConfigService.registerNgxBootstrapDatePickerLocales();

@NgModule({
    imports: [
        CommonModule,
        FormsModule,
        ModalModule.forRoot(),
        TabsModule,
        TooltipModule,
        AppCommonModule,
        UtilsModule,
        MainRoutingModule,
        CountoModule,
        NgxChartsModule,
        BsDatepickerModule.forRoot(),
        BsDropdownModule.forRoot(),
        PopoverModule.forRoot(),
        AgmCoreModule.forRoot({
          apiKey: 'AIzaSyDS2kFDBSQClK7PEB8p9gy23KBtP2_MLtE'
        }),
    ],
    declarations: [
        DashboardComponent,
        FlyOutComponent,
        FlyOutLocationModalComponent,
        FlyOutPackageTypeModalComponent,
        FlyOutFleetModalComponent,
        FlyOutDriverModalComponent,
        FlyOutContactsModalComponent,
        ContactFormMainComponent,
        AddressFormMainComponent
    ],
    providers: [
        { provide: BsDatepickerConfig, useFactory: NgxBootstrapDatePickerConfigService.getDatepickerConfig },
        { provide: BsDaterangepickerConfig, useFactory: NgxBootstrapDatePickerConfigService.getDaterangepickerConfig },
        { provide: BsLocaleService, useFactory: NgxBootstrapDatePickerConfigService.getDatepickerLocale }
    ]
})
export class MainModule { }
