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

import { Observable } from 'rxjs';

import { BlockComponent } from '@cc/shared/block';

import { Block } from '../models';

@Component({
    selector: '@module.scope-name@-ct',
    changeDetection: ChangeDetectionStrategy.OnPush,
    template: `
        <@module.scope-name@-cp
            [block]="block$ | async">
        </@module.scope-name@-cp>`,
})
export class ContainerComponent implements BlockComponent, OnInit, OnDestroy {
    @Input() readonly block: Block;

    block$: Observable<Block>;

    constructor() {
    }

    ngOnInit(): void {
        this.asyncPipeObs();
    }

    ngOnDestroy(): void {
    }

    private asyncPipeObs(): void {
        // todo: retrieve block$ from the store
        // this.block$
    }
}
