import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';

import { HttpClientModule } from "@angular/common/http";

import { FormsModule, ReactiveFormsModule} from '@angular/forms';
import { FormlyModule } from '@ngx-formly/core';
import { FormlyBootstrapModule } from '@ngx-formly/bootstrap';

import { EditorModule } from '@tinymce/tinymce-angular';

import { CardComponent } from './card/card.component';
import { ListComponent } from './list/list.component';
import { ArrayTypeComponent } from "./types/array.type";
import { ObjectTypeComponent } from "./types/object.type";
import { DatetimeTypeComponent } from "./types/datetime.type";
import { DateTypeComponent } from "./types/date.type";
import { ApiService, CrudService, ImageUploaderCrudService } from "./crud.service";
import { CrudFormlyJsonschemaService } from "./crud-formly-jsonschema.service";
import { NgbModule} from "@ng-bootstrap/ng-bootstrap";
import { allIcons, NgxBootstrapIconsModule } from "ngx-bootstrap-icons";
import { JsonschemasService } from "./jsonschemas.service";
import { MultiSchemaTypeComponent } from "./types/multischema.type";
import { ForeignkeyTypeComponent } from "./types/foreignkey.type";
import { HiddenTypeComponent } from "./types/hidden.type";
import { DictionaryTypeComponent } from "./types/dictionary.type";
import { DictionaryService } from "./types/dictionary.service";
import { RichtextTypeComponent } from "./types/richtext.type";
import { SignatureLinkTypeComponent } from "@common/crud/types/signature-link.type";
import { ClipboardModule } from '@angular/cdk/clipboard';
import {FilterListComponent} from "@common/crud/list/filter-list.component";


@NgModule({
  declarations: [
    CardComponent,
    ListComponent,
    FilterListComponent,
    ObjectTypeComponent,
    DatetimeTypeComponent,
    DateTypeComponent,
    ArrayTypeComponent,
    MultiSchemaTypeComponent,
    ForeignkeyTypeComponent,
    HiddenTypeComponent,
    DictionaryTypeComponent,
    RichtextTypeComponent,
    SignatureLinkTypeComponent
  ],
  providers: [
      JsonschemasService,
      ApiService,
      CrudService,
      ImageUploaderCrudService,
      CrudFormlyJsonschemaService,
      DictionaryService
  ],
  imports: [
    CommonModule,
    HttpClientModule,
    FormsModule,
    NgbModule,
    NgxBootstrapIconsModule.pick(allIcons),
    //BrowserAnimationsModule,
    ReactiveFormsModule,
    FormlyModule.forRoot({
      types: [
        { name: 'object', component: ObjectTypeComponent },
        { name: 'datetime', component: DatetimeTypeComponent },
        { name: 'date', component: DateTypeComponent },
        { name: 'array', component: ArrayTypeComponent },
        { name: 'multischema', component: MultiSchemaTypeComponent },
        { name: 'foreign-key', component: ForeignkeyTypeComponent },
        { name: 'hidden', component: HiddenTypeComponent },
        { name: 'dictionary', component: DictionaryTypeComponent },
        { name: 'richtext', component: RichtextTypeComponent },
        { name: 'signature-link', component: SignatureLinkTypeComponent },
      ]
    }),
    FormlyBootstrapModule,
    EditorModule,
    ClipboardModule
  ],
  exports: [
    CardComponent,
    ListComponent
  ],
})
export class CrudModule { }

