/**
 * This file is part of Anis Client.
 *
 * @copyright Laboratoire d'Astrophysique de Marseille / CNRS
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

import { Component } from '@angular/core';

import { Store } from '@ngrx/store';
import { Observable } from 'rxjs';

import { Instance } from 'src/app/metamodel/models';
import * as instanceSelector from 'src/app/metamodel/selectors/instance.selector';
import { AppConfigService } from 'src/app/app-config.service';

/**
 * @class
 * @classdesc Home component.
 */
@Component({
    selector: 'app-home',
    templateUrl: 'home.component.html'
})
export class HomeComponent {
    public instance: Observable<Instance>;

    constructor(private store: Store<{ }>, private config: AppConfigService) {
        this.instance = this.store.select(instanceSelector.selectInstanceByRouteName);
    }

    /**
     * Returns API url.
     *
     * @return string
     */
    getApiUrl(): string {
        return this.config.apiUrl;
    }
}