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

import {ElementFilter, UserService, UsersFilter} from 'm2-core';
import {CdDemoComponent} from '../../../abstract/CdDemoComponent';


@Component({
    template: `
        <div *ngIf="!isInitialized" class="h-100 busy-modal"></div>
        
        <div class="cd-demo-widget h-100">
            <journal-editor-lazy 
                    *ngIf="filters"
                    [initFilters]="filters"
                    (initialized)="isInitialized = true"
            >
            </journal-editor-lazy>
        </div>
    `
})
export class CdJournalDemoComponent extends CdDemoComponent implements OnInit {

    constructor(
        private userService: UserService
    ) {
        super();
    }

    isInitialized = false;
    filters?: ElementFilter[];

    async ngOnInit() {
        this.filters = [new UsersFilter([this.userService.getAccount().login])];
    }

}
