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

import {Observable} from 'rxjs';
import {map} from 'rxjs/operators';

import {ClientConfigService, TransactionService} from 'm2-core';


@Component({
    template: `
        <node-card-lazy
                [nodeId]="nodeId$ | async"
                [editModeON]="editModeON$ | async"
        >
        </node-card-lazy>
    `
})
export class CdNodesTreeChildDemoComponent {

    constructor(
        private activatedRoute: ActivatedRoute,
        protected clientConfigService: ClientConfigService,
        private txService: TransactionService
    ) {
    }

    editModeON$ = this.txService.editModeON$;

    nodeId$: Observable<number> = this.activatedRoute.params
        .pipe(map(params => +params['nodeId']));

}
