import { loadRemoteModule } from '@angular-architects/module-federation'
import { Component, ComponentFactoryResolver, OnInit, ViewContainerRef } from '@angular/core'
import { Router } from '@angular/router'
import { MySharedService } from 'my-shared'
import AutoFit from 'autofit.js'
@Component({
  selector: 'app-root',
  template: ` <router-outlet></router-outlet> `,
  styleUrls: ['./app.component.scss'],
  providers: [
    // MySharedService
  ],
})
export class AppComponent implements OnInit {
  title = 'shell'
  data: any
  constructor(
    private router: Router,
    private mySharedService: MySharedService,
    private resolver: ComponentFactoryResolver,
    private vcRef: ViewContainerRef
  ) {
    // console.log('app-data', this.data)
    // this.mfe1data = this.mySharedService.getData()
    // console.log('mySharedService', this.mySharedService)
    // console.log('data', this.mfe1data)
  }

  ngOnInit() {
    // console.log('app-getData', this.mySharedService)
    ;(window as any).__DW_MFA_ENV__ = true
    this.data = this.mySharedService.getData() || '123213'
    console.log('Shell HomeComponent Init')
    AutoFit.init(
      {
        dh: 1080,
        dw: 1920,
        el: '#app',
        resize: true,
      },
      false
    )
  }
  goToTask(type: string) {
    this.router.navigate(['/task'])
  }

  test() {}

  goToShell(): void {
    this.router.navigate([''])
  }
}
