import { NgModule, enableProdMode, LOCALE_ID }		from '@angular/core'
import { CommonModule, registerLocaleData }			from '@angular/common'
import { FormsModule }                				from '@angular/forms'
import { HttpModule }                 				from '@angular/http'
import { HttpClientModule, HTTP_INTERCEPTORS }           				from '@angular/common/http'

import '@k-core/extensions/rxjs.extension'

// ---- Module specific ----

// Components
import { AppIdeMoblerComponent }			from './components/app/cmp.app'

// Route
import { AppRoutingModule }         	from './rte.app'



// ---- Components ----
// Core
import { BreadCrumbsComponent }			from '@k-core/modules/app-base/components/breadcrumbs/cmp.breadcrumbs' // Placement of this makes no sense
import { PrivacyPageComponent }			from '@k-core/modules/videoConsent/components/privacy-page/cmp.privacy-page' // This should be a module
import { CampaignDialogComponent, CampaignDialogContentComponent } from '@k-core/modules/app-base/components/campaign-dialog/cmp.campaign-dialog'



// ---- Views ----
// Core
import { SuccessPageView }				from '@k-core/views/layout/success-page/view.success-page' // This should be a module
import { CartSentView }					from '@k-core/views/layout/cart-sent/view.cart-sent' // This should be a module
import { BasketHelperService } from '@k-core/modules/basket/services/svc.basket-helper'

// Site
import { FrontpageView_IDE }			from '@k-sites/ilva/views/frontpage/view.frontpage' // This could be a lazyloaded module



// ---- Modules ----
// Core
import { SharedModule }             	from '@k-core/modules/shared/mod.shared'
import { LayoutModule }             	from '@k-core/modules/layout/mod.layout'
import { LanguageModule }				from '@k-core/modules/language/mod.language'
import { StoredropdownModule } 			from '@k-core/modules/storeDropdown/mod.storeDropdown'

// Site
import { FooterModule }					from '@k-sites/ilva/modules/footer/mod.footer'
import { HeaderModule }					from '@k-sites/ilva/modules/header/mod.header'
import { MenuModule }					from '@k-sites/ilva/modules/menu/mod.menu'
import { BlockModule }					from '@k-sites/ilva/modules/block/mod.block'



// ---- Services ----


// Material
import { MatDialogModule, MAT_DIALOG_DEFAULT_OPTIONS } 	from '@angular/material'
import { MatIconModule }                				from '@angular/material/icon'

// Common
import { CommonDiscountServices } 		from '@k-common/discount/com.discount-services'
import { BasketPartialModule } 			from '@k-core/modules/basket-partial/mod.basket-partial'
import { CommonCollectionGeneralServicesModule } from '@k-core/common/collections/com.generalServices'

import localeDa from '@angular/common/locales/da'
import { BasketService } from '@k-core/services/svc.basket'
registerLocaleData(localeDa, 'da')

enableProdMode();

@NgModule({
	declarations: [
		// Structural Components
		// AppComponent,
		AppIdeMoblerComponent,
		BreadCrumbsComponent,
		PrivacyPageComponent,
		CampaignDialogComponent,
		CampaignDialogContentComponent,
		
		// Eagerly loaded components
		FrontpageView_IDE,// Could be lazyloaded
		SuccessPageView, // Could be lazyloaded
		CartSentView	// Could be lazyloaded
	],
	imports: [
		// Core Modules
		SharedModule,
		CommonModule,
		FormsModule,
		HttpModule, // Old and busted
		HttpClientModule, // New hotness
		
		// Material
		MatDialogModule,
		MatIconModule,

		// Routing, must be before Eagerly loaded modules
		AppRoutingModule,
		
		// Partial Modules
		BasketPartialModule,
		CommonDiscountServices,
		CommonCollectionGeneralServicesModule,
		
		// Structural Modules (Eagerly loaded, as they're required to build the actual page)
		MenuModule, // Should be moved to LayoutModule
		HeaderModule, // Should be moved to LayoutModule
		FooterModule, // Should be moved to LayoutModule
		LanguageModule, // Should be moved to LayoutModule
		StoredropdownModule, // Could be loaded the needed places instead of globally as a common module
		
		// Eager modules
		// TODO: Scan through layoutModule and see if this can be eliminated, if possible, change this to be an ACTUAL layout module, that includes footer, header, language, menu etc. the stuff required for layout, and make it a common module
		LayoutModule,
		BlockModule
		
	],
	exports: [],
	entryComponents: [
        CampaignDialogContentComponent
    ],
	providers: [
		BasketService,
		BasketHelperService,
		{ provide: MAT_DIALOG_DEFAULT_OPTIONS, useValue: {hasBackdrop: true} },
		{ provide: LOCALE_ID, useValue: 'da-DK' },
	]
})
export class AppModule {}
