/*
 * Copyright (C) 2018 Robert Bosch GmbH Copyright (C) 2018 Robert Bosch Manufacturing Solutions GmbH, Germany. All rights reserved.
 */

import { OverlayModule } from '@angular/cdk/overlay';
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { MatBadgeModule } from '@angular/material/badge';
import { MatButtonModule } from '@angular/material/button';
import { MatButtonToggleModule } from '@angular/material/button-toggle';
import { MatSliderModule } from '@angular/material/slider';
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
import { MatCardModule } from '@angular/material/card';
import { MatChipsModule } from '@angular/material/chips';
import { MAT_TABS_CONFIG, MatTabsConfig, MatTabsModule } from '@angular/material/tabs';
import { MatDialogModule } from '@angular/material/dialog';
import { MatExpansionModule } from '@angular/material/expansion';
import { MAT_FORM_FIELD_DEFAULT_OPTIONS, MatFormFieldModule } from '@angular/material/form-field';
import { MatIconModule } from '@angular/material/icon';
import { MatInputModule } from '@angular/material/input';
import { MatListModule } from '@angular/material/list';
import { MatMenuModule } from '@angular/material/menu';
import { MatSidenavModule } from '@angular/material/sidenav';
import { MatSnackBarModule } from '@angular/material/snack-bar';
import { MatToolbarModule } from '@angular/material/toolbar';
import { MatTooltipModule } from '@angular/material/tooltip';
import { MatRadioModule } from '@angular/material/radio';
import { MatAutocompleteModule } from '@angular/material/autocomplete';
import { ActivityIndicatorDirective } from './activity-indicator/activity-indicator.directive';
import { BreadcrumbsModule } from './breadcrumbs/breadcrumbs.module';
import { CalloutComponent } from './callout/callout.component';
import { BciFormFieldNotificationComponent } from './bci-form-field-notification/bci-form-field-notification.component';
import { BciMatTabGroupModule } from './bci-mat-tab-group/bci-mat-tab-group.module';
import { BciChipComponent } from './chip/chip.component';
import { BciChipSelectableComponent } from './chip-selectable/chip-selectable.component';
import { BCI_COLUMN_SELECTOR_INTL_PROVIDER } from './column-selector/column-selector-intl';
import { CommandbarActionsComponent } from './commandbar/actions/actions.component';
import { CommandbarActiveFiltersComponent } from './commandbar/active-filters/active-filters.component';
import { CommandbarButtonComponent } from './commandbar/button/commandbar-button.component';
import { ClickOutsideDirective } from './commandbar/click-outside.directive';
import { CommandbarButtonsDirective } from './commandbar/commandbar-buttons.directive';
import { CommandbarComponent } from './commandbar/commandbar.component';
import { CommandbarInlinefilterComponent } from './commandbar/inlinefilter/commandbar-inlinefilter.component';
import { CommandbarInlinefiltersComponent } from './commandbar/inlinefilters/commandbar-inlinefilters.component';
import { CommandbarItemComponent } from './commandbar/item/commandbar-item.component';
import {
  COMMANDBAR_OPTIONSMENU_DATA,
  CommandbarOptionsmenuComponent,
} from './commandbar/optionsmenu/commandbar-optionsmenu.component';
import { OptionsmenuDialogComponent } from './commandbar/optionsmenu/optionsmenu-dialog/optionsmenu-dialog.component';
import { CommandbarQuickfiltersComponent } from './commandbar/quickfilters/commandbar-quickfilters.component';
import { CommandbarSidebarRoutingNavigatorDirective } from './commandbar/sidebar/commandbar-sidebar-routing-navigator.directive';
import {
  CommandbarSidebarSlideComponent,
  CommandbarSidebarSlideFooterDirective,
  CommandbarSidebarSlideHeaderDirective,
} from './commandbar/sidebar/commandbar-sidebar-slide.component';
import { CommandbarSidebarComponent } from './commandbar/sidebar/commandbar-sidebar.component';
import { ToggleButtonDirective } from './commandbar/toggle-button.directive';
import { ContentSidebarItemComponent } from './content-sidebar-item/content-sidebar-item.component';
import { ContentSidebarComponent } from './content-sidebar/content-sidebar.component';
import { ContentWSidePanelComponent } from './content-w-side-panel/content-w-side-panel.component';
import { BciFilesizeModule } from './filesize/filesize.module';
import { FilterPanelComponent } from './filter-panel/filter-panel.component';
import { FilterEntryComponent } from './filter-picker/filter-entry/filter-entry.component';
import { FilterPickerComponent } from './filter-picker/filter-picker.component';
import { FullscreenDirective } from './fullscreen/fullscreen.directive';
import { ClickableItemDirective } from './interaction/clickable-item.directive';
import { LoadingSpinnerDirective } from './loading-spinner/loading-spinner.directive';
import { ListSkeletonComponent } from './loading-text-skeleton/list-skeleton/list-skeleton.component';
import { LoadingTextSkeletonDirective } from './loading-text-skeleton/loading-text-skeleton.directive';
import { TableSkeletonComponent } from './loading-text-skeleton/table-skeleton/table-skeleton.component';
import { TilesSkeletonComponent } from './loading-text-skeleton/tiles-skeleton/tiles-skeleton.component';
import { DetailViewComponent } from './master-detail/detail/detail-view.component';
import { MasterDetailViewComponent } from './master-detail/master-detail-view.component';
import { MasterViewComponent } from './master-detail/master/master-view.component';
import { NoValuePipeModule } from './no-value/no-value.pipe.module';
import { OverviewTileComponent } from './overview-tile/overview-tile.component';
import { PageContentComponent } from './page-content/page-content.component';
import { ResizeHandleComponent } from './resize-handle/resize-handle.component';
import { SidePanelItemComponent } from './side-panel-item/side-panel-item.component';
import { SidePanelComponent } from './side-panel/side-panel.component';
import { SplitterAreaComponent } from './splitter/splitter-area/splitter-area.component';
import { SplitterComponent } from './splitter/splitter.component';
import { TableContainerComponent } from './table-container/table-container.component';
import { BciTileComponent } from './tile/tile.component';
import { ContentFullscreenDirective } from './content-fullscreen/content-fullscreen.directive';
import { BciChipListAutocompleteComponent } from './chip-list-autocomplete/chip-list-autocomplete.component';
import { CommandbarAddMenuComponent } from './commandbar/addmenu/commandbar-addmenu.component';
import { BCI_PICKLIST_INTL_PROVIDER } from './picklist/picklist-intl';
import { MatStepperModule } from '@angular/material/stepper';
import { HorizontalStepperDirective } from './stepper/horizontal-stepper.directive';
import { MultiFileSelectComponent } from './multi-file-select/multi-file-select.component';
import { BCI_MULTI_FILE_SELECT_INTL_PROVIDER } from './multi-file-select/multi-file-select-intl';
import { TableStripedColumnsDirective } from './table-striped-columns/table-striped-columns.directive';
import { BciPrimaryButtonDirective } from './bci-button-primary/bci-primary-button.directive';
import { BciSecondaryButtonDirective } from './bci-button-secondary/bci-secondary-button.directive';
import { BciTertiaryButtonDirective } from './bci-button-tertiary/bci-tertiary-button.directive';
import { BciIntegratedButtonDirective } from './bci-button-integrated/bci-integrated-button.directive';
import { BciCheckListDirective } from './bci-check-list/bci-check-list.directive';
import { BciValueModificatorButtonDirective } from './bci-value-modificator-button/bci-value-modificator-button.directive';
import { BciSpanForValueModificatorButtonDirective } from './bci-span-for-value-modificator-button/bci-span-for-value-modificator-button.directive';
import { BciCardBorderDirective } from './bci-card-border/bci-card-border.directive';
import { BciLinkModule } from './bci-link/bci-link.module';
import { BciTabNavigationCustomPaddingDirective } from './bci-tab-navigation-custom-padding/bci-tab-navigation-custom-padding.directive';
import { BciEmptyStateModule } from './bci-empty-state/bci-empty-state.module';
import { BciListDirective } from './bci-list/bci-list.directive';
import { BciSelectModule } from './bci-select/bci-select.module';
import { BciMatExpansionSmallDirective } from './bci-mat-expansion-small';
import { BciShowHideDirective } from '../core/core-configuration/bci-show-hide';
import { BCI_CORE_PICKLIST_INTL_PROVIDER } from './bci-core-picklist/bci-core-picklist-intl';
import {LabelValuePairComponent} from "./label-value-pair";
import { MenuMaxHeightDirective } from './menu-max-height/menu-max-height.directive';
import { BciFilterComponent, BciFilterTabComponent, BciFilterSectionComponent, BciFilterFieldComponent } from './bci-complex-filter';
import { BciCommandbarSpecialMarginIntegratedButtonDirective } from './commandbar/bci-commandbar-special-margin-integrated-button.directive';
import { BciCommandbarSpecialMarginChipsDirective } from './commandbar/bci-commandbar-special-margin-chips.directive';
import { CardSkeletonComponent } from './loading-text-skeleton/card-skeleton/card-skeleton.component';

const globalTabConfig: MatTabsConfig = {
  fitInkBarToContent : true,
  stretchTabs: false
}

@NgModule({
  imports: [
    CommonModule,
    // TODO: needed?
    FormsModule,
    ReactiveFormsModule,
    BreadcrumbsModule,
    BciMatTabGroupModule,
    BciLinkModule,
    /* Angular Material */
    MatCardModule,
    MatAutocompleteModule,
    MatChipsModule,
    MatButtonModule,
    MatSidenavModule,
    MatToolbarModule,
    MatFormFieldModule,
    MatIconModule,
    MatTabsModule,
    MatInputModule,
    MatMenuModule,
    MatTabsModule,
    MatSliderModule,
    MatButtonModule,
    MatRadioModule,
    MatButtonToggleModule,
    MatSlideToggleModule,
    MatSnackBarModule,
    MatStepperModule,
    MatTooltipModule,
    MatDialogModule,
    MatListModule,
    MatExpansionModule,
    MatBadgeModule,
    /* CDK */
    OverlayModule,
    NoValuePipeModule,
    BciFilesizeModule,
    BciEmptyStateModule,
    BciSelectModule,
  ],
  declarations: [
    FilterPanelComponent,
    SidePanelComponent,
    SidePanelItemComponent,
    ContentSidebarComponent,
    ContentSidebarItemComponent,
    ContentWSidePanelComponent,
    LoadingSpinnerDirective,
    LoadingTextSkeletonDirective,
    BciChipComponent,
    BciChipSelectableComponent,
    BciChipListAutocompleteComponent,
    CalloutComponent,
    BciFormFieldNotificationComponent,
    BciTileComponent,
    OverviewTileComponent,
    CommandbarItemComponent,
    CommandbarButtonComponent,
    CommandbarButtonsDirective,
    CommandbarComponent,
    CommandbarActionsComponent,
    CommandbarInlinefiltersComponent,
    CommandbarInlinefilterComponent,
    CommandbarQuickfiltersComponent,
    CommandbarSidebarComponent,
    BciCommandbarSpecialMarginIntegratedButtonDirective,
    BciCommandbarSpecialMarginChipsDirective,
    CommandbarSidebarSlideComponent,
    CommandbarSidebarSlideHeaderDirective,
    CommandbarSidebarSlideFooterDirective,
    CommandbarSidebarRoutingNavigatorDirective,
    BciFilterComponent,
    BciFilterTabComponent,
    BciFilterSectionComponent,
    BciFilterFieldComponent,
    ToggleButtonDirective,
    ClickOutsideDirective,
    CommandbarActiveFiltersComponent,
    MasterDetailViewComponent,
    MasterViewComponent,
    DetailViewComponent,
    FilterPickerComponent,
    FilterEntryComponent,
    PageContentComponent,
    CommandbarSidebarSlideComponent,
    ClickableItemDirective,
    CommandbarSidebarRoutingNavigatorDirective,
    TableContainerComponent,
    BciShowHideDirective,
    FullscreenDirective,
    TableSkeletonComponent,
    TilesSkeletonComponent,
    CardSkeletonComponent,
    ListSkeletonComponent,
    SplitterComponent,
    SplitterAreaComponent,
    ResizeHandleComponent,
    CommandbarOptionsmenuComponent,
    OptionsmenuDialogComponent,
    CommandbarAddMenuComponent,
    ActivityIndicatorDirective,
    TableStripedColumnsDirective,
    HorizontalStepperDirective,
    ContentFullscreenDirective,
    MenuMaxHeightDirective,
    BciPrimaryButtonDirective,
    BciSecondaryButtonDirective,
    BciTertiaryButtonDirective,
    BciTabNavigationCustomPaddingDirective,
    BciIntegratedButtonDirective,
    BciCheckListDirective,
    BciListDirective,
    BciMatExpansionSmallDirective,
    BciValueModificatorButtonDirective,
    BciSpanForValueModificatorButtonDirective,
    BciCardBorderDirective,
    LabelValuePairComponent,
    MultiFileSelectComponent,
  ],
  exports: [
    CommonModule,
    FormsModule,
    BreadcrumbsModule,
    BciMatTabGroupModule,
    BciLinkModule,
    BciChipComponent,
    BciChipSelectableComponent,
    CalloutComponent,
    BciFormFieldNotificationComponent,
    FilterPanelComponent,
    SidePanelComponent,
    SidePanelItemComponent,
    ContentSidebarComponent,
    ContentSidebarItemComponent,
    ContentWSidePanelComponent,
    LoadingSpinnerDirective,
    LoadingTextSkeletonDirective,
    BciTileComponent,
    MasterDetailViewComponent,
    MasterViewComponent,
    DetailViewComponent,
    CommandbarItemComponent,
    CommandbarButtonComponent,
    CommandbarButtonsDirective,
    CommandbarComponent,
    CommandbarActionsComponent,
    CommandbarInlinefiltersComponent,
    CommandbarInlinefilterComponent,
    CommandbarQuickfiltersComponent,
    CommandbarSidebarComponent,
    BciCommandbarSpecialMarginIntegratedButtonDirective,
    BciCommandbarSpecialMarginChipsDirective,
    CommandbarSidebarSlideComponent,
    CommandbarSidebarSlideHeaderDirective,
    CommandbarSidebarSlideFooterDirective,
    CommandbarSidebarRoutingNavigatorDirective,
    BciFilterComponent,
    BciFilterTabComponent,
    BciFilterSectionComponent,
    BciFilterFieldComponent,
    ToggleButtonDirective,
    ClickOutsideDirective,
    CommandbarActiveFiltersComponent,
    FilterPickerComponent,
    FilterEntryComponent,
    PageContentComponent,
    ClickableItemDirective,
    OverviewTileComponent,
    FullscreenDirective,
    TableSkeletonComponent,
    TilesSkeletonComponent,
    CardSkeletonComponent,
    ListSkeletonComponent,
    SplitterComponent,
    SplitterAreaComponent,
    ResizeHandleComponent,
    CommandbarOptionsmenuComponent,
    OptionsmenuDialogComponent,
    CommandbarAddMenuComponent,
    ActivityIndicatorDirective,
    NoValuePipeModule,
    /* Angular Material */
    MatCardModule,
    MatButtonModule,
    MatSidenavModule,
    BciShowHideDirective,
    TableStripedColumnsDirective,
    HorizontalStepperDirective,
    ContentFullscreenDirective,
    MenuMaxHeightDirective,
    TableContainerComponent,
    BciChipListAutocompleteComponent,
    BciPrimaryButtonDirective,
    BciSecondaryButtonDirective,
    BciTertiaryButtonDirective,
    BciIntegratedButtonDirective,
    BciTabNavigationCustomPaddingDirective,
    BciCheckListDirective,
    BciListDirective,
    BciMatExpansionSmallDirective,
    BciValueModificatorButtonDirective,
    BciSpanForValueModificatorButtonDirective,
    BciCardBorderDirective,
    BciEmptyStateModule,
    BciSelectModule,
    BciFilesizeModule,
    LabelValuePairComponent,
    MultiFileSelectComponent,
  ],
  providers: [
    BCI_PICKLIST_INTL_PROVIDER,
    BCI_CORE_PICKLIST_INTL_PROVIDER,
    BCI_COLUMN_SELECTOR_INTL_PROVIDER,
    BCI_MULTI_FILE_SELECT_INTL_PROVIDER,
    {
      provide: COMMANDBAR_OPTIONSMENU_DATA,
      useValue: {},
    },
    {
      provide: MAT_TABS_CONFIG,
      useValue: globalTabConfig
    },
    { provide: MAT_FORM_FIELD_DEFAULT_OPTIONS, useValue: { floatLabel: 'always' } },
  ],
})
export class BciSharedModule {}
