import {ChangeDetectionStrategy, Component, Input} from "@angular/core";
import {UserService, Session} from "@webbpm/base-package";
import {NgbDropdownConfig, Placement} from "@ng-bootstrap/ng-bootstrap";
import {Observable} from "rxjs";
import {SharedModule} from "shared";
import {AsyncPipe} from "@angular/common";

@Component({
    selector: 'admin-menu',
    templateUrl: './admin_menu.html',
    providers: [NgbDropdownConfig],
    imports: [AsyncPipe, SharedModule],
    changeDetection: ChangeDetectionStrategy.OnPush
})
export class AdminMenuComponent {

  @Input()
  public placement: Placement = 'bottom';
  public currentSession: Observable<Session>;

  constructor(protected userService: UserService, public config: NgbDropdownConfig) {
    this.config.placement = this.placement;
    this.currentSession = this.userService.getCurrentSession();
  }
}
