import { Component, OnInit } from '@angular/core';
import { NetworkService } from '@shared/services/network.service';
import { AppSettingsService } from '@shared/services';

@Component({
    selector: 'app-version',
    templateUrl: './app-version.component.html',
    styleUrls: ['./app-version.component.scss'],
})
export class AppVersionComponent implements OnInit {
    apiVersion: string;
    isVisible: boolean;

    constructor(private networkService: NetworkService, private settingsService: AppSettingsService) {}

    async ngOnInit() {
        this.apiVersion = await this.networkService.getApiVersion();
        this.isVisible = (await this.settingsService.getSettings()).showDebugVersion;
        if (this.isVisible) {
            document.querySelector<HTMLElement>('.banner--top')!.style.display='block';
        }
    }
}
