import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { NativeScriptCommonModule } from '@nativescript/angular';
import { NgxsModule } from '@ngxs/store';
import { BarcodeScanner } from 'nativescript-barcodescanner';
import { NativeScriptUIChartModule } from 'nativescript-ui-chart/angular/chart-directives';
import { NativeScriptUIDataFormModule } from 'nativescript-ui-dataform/angular/dataform-directives';
import { NativeScriptUIListViewModule } from 'nativescript-ui-listview/angular';
import { SharedModule } from '~/shared/shared.module';
import { MaterialReservationListComponent } from './components/material-reservation-list-view/material-reservation-list-view.component';
import { MaterialUnitListComponent } from './components/material-unit-list-view/material-unit-list-view.component';
import { ModalDatePickerComponent } from './components/modal-view-date-picker/modal-view-date-picker.component';
import { ModalHelpComponent } from './components/modal-view-help/modal-view-help.component';
import { ReservationBorrowedListComponent } from './components/reservation-borrowed-list-view/reservation-borrowed-list-view.component';
import { ReservationLentListComponent } from './components/reservation-lent-list-view/reservation-lent-list-view.component';
import { ReservationListComponent } from './components/reservation-list-view/reservation-list-view.component';
import { WarehouseUnitListComponent } from './components/warehouse-unit-list-view/warehouse-unit-list-view.component';
import { InventoryConfirmedComponent } from './containers/inventory-confirmed/inventory-confirmed.component';
import { InventoryNewComponent } from './containers/inventory-new/inventory-new.component';
import { InventoryWaitingConfirmComponent } from './containers/inventory-waiting-confirm/inventory-waiting-confirm.component';
import { InventoryWarehouseComponent } from './containers/inventory-warehouse/inventory-warehouse.component';
import { InventoryComponent } from './containers/inventory/inventory.component';
import { MaterialDeleteComponent } from './containers/material-delete/material-delete.component';
import { MaterialDetailComponent } from './containers/material-detail/material-detail.component';
import { MaterialLendComponent } from './containers/material-lend/material-lend.component';
import { MaterialNewComponent } from './containers/material-new/material-new.component';
import { MaterialUnitComponent } from './containers/material-unit/material-unit.component';
import { MaterialUpdateComponent } from './containers/material-update/material-update.component';
import { MaterialComponent } from './containers/material/material.component';
import { ReservationBorrowedDetailComponent } from './containers/reservation-borrowed-detail/reservation-borrowed-detail.component';
import { ReservationBorrowedComponent } from './containers/reservation-borrowed/reservation-borrowed.component';
import { ReservationLentDetailComponent } from './containers/reservation-lent-detail/reservation-lent-detail.component';
import { ReservationLentComponent } from './containers/reservation-lent/reservation-lent.component';
import { ReservationNewComponent } from './containers/reservation-new/reservation-new.component';
import { ReservationUpdateComponent } from './containers/reservation-update/reservation-update.component';
import { ReservationComponent } from './containers/reservation/reservation.component';
import { WarehouseDetailComponent } from './containers/warehouse-detail/warehouse-detail.component';
import { WarehouseUnitComponent } from './containers/warehouse-unit/warehouse-unit.component';
import { WarehouseUpdateComponent } from './containers/warehouse-update/warehouse-update.component';
import { MaterialRoutingModule } from './material-routing.module';
import { DatabaseService } from './services/database.service';
import { InventoryNewState } from './state-mgmt/inventory-new.state';
import { InventoryWaitingConfirmState } from './state-mgmt/inventory-waiting-confirm.state';
import { InventoryState } from './state-mgmt/inventory.state';
import { MaterialDeleteState } from './state-mgmt/material-delete.state';
import { MaterialDetailState } from './state-mgmt/material-detail.state';
import { MaterialLendState } from './state-mgmt/material-lend.state';
import { MaterialNewState } from './state-mgmt/material-new.state';
import { MaterialUnitState } from './state-mgmt/material-unit.state';
import { MaterialUpdateState } from './state-mgmt/material-update.state';
import { ReservationBorrowedDetailState } from './state-mgmt/reservation-borrowed-detail.state';
import { ReservationBorrowedState } from './state-mgmt/reservation-borrowed.state';
import { ReservationLentDetailState } from './state-mgmt/reservation-lent-detail.state';
import { ReservationLentState } from './state-mgmt/reservation-lent.state';
import { ReservationNewState } from './state-mgmt/reservation-new.state';
import { ReservationUpdateState } from './state-mgmt/reservation-update.state';
import { ReservationState } from './state-mgmt/reservation.state';
import { WarehouseDetailState } from './state-mgmt/warehouse-detail.state';
import { WarehouseUnitState } from './state-mgmt/warehouse-unit.state';
import { WarehouseUpdateState } from './state-mgmt/warehouse-update.state';

@NgModule({
    imports: [
        NativeScriptCommonModule,
        MaterialRoutingModule,
        NativeScriptUIListViewModule,
        NativeScriptUIDataFormModule,
        NativeScriptUIChartModule,
        SharedModule,
        FormsModule,
        NgxsModule.forFeature([
            MaterialUnitState,
            MaterialDetailState,
            MaterialUpdateState,
            MaterialNewState,
            MaterialLendState,
            MaterialDeleteState,

            WarehouseUnitState,
            WarehouseDetailState,
            WarehouseUpdateState,

            ReservationState,
            ReservationNewState,
            ReservationUpdateState,

            ReservationBorrowedState,
            ReservationBorrowedDetailState,

            ReservationLentState,
            ReservationLentDetailState,

            InventoryState,
            InventoryWaitingConfirmState,
            InventoryNewState

        ])
    ],
    declarations: [
        MaterialComponent,

        MaterialDetailComponent,
        MaterialUpdateComponent,
        MaterialUnitComponent,
        MaterialUnitListComponent,
        MaterialLendComponent,
        MaterialReservationListComponent,
        MaterialDeleteComponent,

        WarehouseUnitComponent,
        WarehouseDetailComponent,
        WarehouseUnitListComponent,
        WarehouseUpdateComponent,
        MaterialNewComponent,

        InventoryComponent,
        InventoryWarehouseComponent,
        InventoryWaitingConfirmComponent,
        InventoryConfirmedComponent,
        InventoryNewComponent,

        ReservationComponent,
        ReservationListComponent,
        ReservationNewComponent,
        ReservationUpdateComponent,

        ReservationBorrowedComponent,
        ReservationBorrowedListComponent,
        ReservationBorrowedDetailComponent,

        ReservationLentComponent,
        ReservationLentListComponent,
        ReservationLentDetailComponent,

        ModalDatePickerComponent,
        ModalHelpComponent

    ],
    providers: [
        DatabaseService,
        BarcodeScanner
        // {
        //     provide: ErrorHandler,
        //     useClass: MaterialErrorHandler
        // },
    ],
    schemas: [
        NO_ERRORS_SCHEMA
    ],
    entryComponents: [ModalDatePickerComponent, ModalHelpComponent]
})
export class MaterialModule {
}
