import {NgModule} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';

import {AppRoutingModule} from './app-routing.module';
import {AppComponent} from './app.component';

import {HTTP_INTERCEPTORS, HttpClient, HttpClientModule} from '@angular/common/http';
import {TranslateLoader, TranslateModule} from '@ngx-translate/core';
import {TranslateHttpLoader} from '@ngx-translate/http-loader';

import {MenubarModule} from 'primeng/menubar';
import { PanelMenuModule } from 'primeng/panelmenu';
import {TabViewModule} from 'primeng/tabview';
import {InputTextModule} from 'primeng/inputtext';
import {InputNumberModule} from 'primeng/inputnumber';
import {ButtonModule} from 'primeng/button';
import {AvatarModule} from 'primeng/avatar';
import {AvatarGroupModule} from 'primeng/avatargroup';
import {MenuModule} from 'primeng/menu';
import {CheckboxModule} from 'primeng/checkbox';
import {SplitButtonModule} from 'primeng/splitbutton';

import {HeaderComponent} from './components/header/header.component';
import {LoginComponent} from './components/login/login.component';
import {FormsModule} from '@angular/forms';
import {HttpRequestInterceptor} from './interceptors/http-request.interceptor';
import {TextWidgetComponent} from "./widgets/text/components/text-widget.component";
import {RawHtmlPipe} from "./pipe/raw-html.pipe";
import {ChartWidgetComponent} from "./widgets/chart/components/chart-widget.component";
import {ChartModule} from "primeng/chart";
import {SkeletonModule} from 'primeng/skeleton';
import {ToastModule} from 'primeng/toast';
import {ConfirmationService, MessageService} from "primeng/api";
import {TableWidgetComponent} from "./widgets/table/components/table-widget.component";
import {TableModule} from 'primeng/table';
import {DialogModule} from "primeng/dialog";
import {ConfirmPopupModule} from "primeng/confirmpopup";
import {CardModule} from "primeng/card";
import {OverlayPanelModule} from "primeng/overlaypanel";
import {DropdownModule} from "primeng/dropdown";
import {TooltipModule} from "primeng/tooltip";
import {PagesComponent} from './components/pages/pages.component';
import {PageComponent} from './components/page/page.component';
import {FilterPagesPipe, PagesListComponent} from './components/pages/pages-list/pages-list.component';
import {MessageModule} from 'primeng/message';
import {DividerModule} from 'primeng/divider';
import {AccordionModule} from 'primeng/accordion';
import {EditorModule} from 'primeng/editor';
import {PageEditorComponent} from './components/page-editor/page-editor.component';
import {PagePropertiesEditorComponent} from './components/page-editor/page-properties-editor/page-properties-editor.component';
import {TextWidgetConfigurationComponent} from './widgets/text/components/text-widget-configuration/text-widget-configuration.component';
import {TableWidgetConfigurationComponent} from './widgets/table/components/table-widget-configuration/table-widget-configuration.component';
import {ChartWidgetConfigurationComponent} from './widgets/chart/components/chart-widget-configuration/chart-widget-configuration.component';
import {AboutUsComponent} from './static-pages/about-us/about-us.component';
import {ColumnPropertiesEditorComponent} from './components/page-editor/column-properties-editor/column-properties-editor.component';
import {HomeComponent} from './static-pages/home/home.component';
import {AsPipe} from './pipe/as.pipe';
import {DatasourceConfigurationParameterComponent} from './components/datasource-configuration/parameters/datasource-configuration-parameter.component';
import {CalendarModule} from "primeng/calendar";
import {ToDatePipe} from "./pipe/to-date.pipe";
import { DatasourceConfigurationComponent } from './components/datasource-configuration/datasource-configuration.component';
import {MultiSelectModule} from "primeng/multiselect";
import {FieldsetModule} from "primeng/fieldset";
import {ColorPickerModule} from "primeng/colorpicker";
import {ProgressSpinnerModule} from "primeng/progressspinner";
import { FormComponent } from './static-pages/form/form.component';
import {DynamicDialogModule} from "primeng/dynamicdialog";
import {InputTextareaModule} from 'primeng/inputtextarea';
import {MessagesModule} from 'primeng/messages';
import { ImageWidgetConfigurationComponent } from './widgets/image/components/configuration/image-widget-configuration.component';
import {ImageWidgetComponent} from "./widgets/image/components/image-widget.component";
import {ImageModule} from 'primeng/image';
import { CssStyleComponent } from './components/css-style/css-style.component';
import { RegisterComponent } from './components/register/register.component';
import { UpdateComponent } from './components/update/update.component';
import { ChangepasswordComponent } from './components/changepassword/changepassword.component';
import {AccountActivateComponent} from "./components/account-activate/account-activate.component";


import { MenuComponent } from './components/menu/menu.component';
import {MatIconModule} from '@angular/material/icon';
import { MatMenuModule } from '@angular/material/menu';
import { MatCheckboxModule } from '@angular/material/checkbox';
import {MatProgressSpinnerModule} from '@angular/material/progress-spinner'; 

import { NgChartsModule } from 'ng2-charts';
import {MatButtonModule} from "@angular/material/button";



// AoT requires an exported function for factories
export function HttpLoaderFactory(http: HttpClient) {
return new TranslateHttpLoader(http, './assets/i18n/', '.json');
//    return new TranslateHttpLoader(http);
}

@NgModule({
    declarations: [
        AppComponent,
        HeaderComponent,
        LoginComponent,
        TextWidgetComponent,
        RawHtmlPipe,
        AsPipe,
        ToDatePipe,
        ChartWidgetComponent,
        TableWidgetComponent,
        PagesComponent,
        PageComponent,
        PagesListComponent,
        FilterPagesPipe,
        PageEditorComponent,
        PagePropertiesEditorComponent,
        TextWidgetConfigurationComponent,
        TableWidgetConfigurationComponent,
        ChartWidgetConfigurationComponent,
        AboutUsComponent,
        ColumnPropertiesEditorComponent,
        HomeComponent,
        DatasourceConfigurationParameterComponent,
        DatasourceConfigurationComponent,
        FormComponent,
        ImageWidgetComponent,
        ImageWidgetConfigurationComponent,
        CssStyleComponent,
        RegisterComponent,
        UpdateComponent,
        ChangepasswordComponent,
        AccountActivateComponent,
        MenuComponent
    ],
    exports: [
        RawHtmlPipe,
        AsPipe
    ],
    imports: [
        BrowserModule,
        BrowserAnimationsModule,
        HttpClientModule,
        AppRoutingModule,
        FormsModule,

        TranslateModule.forRoot({
            loader: {
                provide: TranslateLoader,
                useFactory: HttpLoaderFactory,
                deps: [HttpClient]
            },
            defaultLanguage: 'en'
        }),

        MenubarModule,
        DynamicDialogModule,
        TabViewModule,
        InputTextModule,
        InputTextareaModule,
        InputNumberModule,
        ButtonModule,
        AvatarModule,
        AvatarGroupModule,
        MenuModule,
        CheckboxModule,
        ChartModule,
        SkeletonModule,
        ToastModule,
        TableModule,
        DialogModule,
        ConfirmPopupModule,
        CardModule,
        OverlayPanelModule,
        DropdownModule,
        TooltipModule,
        SplitButtonModule,
        MessageModule,
        MessagesModule,
        DividerModule,
        AccordionModule,
        EditorModule,
        CalendarModule,
        MultiSelectModule,
        FieldsetModule,
        ColorPickerModule,
        ProgressSpinnerModule,
        ImageModule,
        PanelMenuModule,
        MatIconModule, 
        MatMenuModule, 
        NgChartsModule,
        MatButtonModule,
        MatProgressSpinnerModule,
        MatCheckboxModule
    ],
    providers: [
        {
            provide: HTTP_INTERCEPTORS,
            useClass: HttpRequestInterceptor,
            multi: true,
        },
        MessageService,
        ConfirmationService
    ],
    bootstrap: [AppComponent]
})
export class AppModule {
}
