import { Component, HostListener, inject } from '@angular/core';
import { RefreshService } from '../../services/button/refresh.service';
import { CreationService } from '../../services/button/creation.service';
import { UpdateService } from '../../services/button/update.service';
import { TransferService } from '../../services/button/transfer.service';
import { DeletionService } from '../../services/button/deletion.service';
import { ButtonVisibilityService } from '../../services/button/button-visibility.service';

@Component({
  selector: 'app-base-page',
  standalone: true,
  imports: [],
  templateUrl: './base-page.component.html',
  styleUrl: './base-page.component.scss'
})
export class BasePageComponent {

  protected refreshService: RefreshService = inject(RefreshService)
  protected creationService: CreationService = inject(CreationService)
  protected updateService: UpdateService = inject(UpdateService)
  protected transferService: TransferService = inject(TransferService)
  protected deletionService: DeletionService = inject(DeletionService)
  protected buttonVisibilityService: ButtonVisibilityService = inject(ButtonVisibilityService)

  constructor() {
    this.refreshService.removeAll()
    this.creationService.disposeComponent();
    if (this.updateService.any) {
      this.updateService.executeAllAsync().then()
    }
    if(this.transferService.any)
      this.transferService.removeAll()
    if(this.deletionService.any)
      this.deletionService.removeAll()
  }
}