import { Inject, Injectable } from '@angular/core';

import { CONFIG_TOKEN } from '@eui/core';

import { BlockConfig, IGenericBlock, UnknownBlockComponent } from '@cc/shared/block';

// BLOCKS
import { ContainerComponent } from '../../blocks/sample/containers/container.component';

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

@Injectable()
export class GenericBlockResolverService implements IGenericBlock {

    constructor(@Inject(CONFIG_TOKEN) private config: any) {
    }

    getComponentForBlock(block: BlockConfig): any {
        switch (block?.config.subType) {
            case BlockType.@module.class.name@: {
                return ContainerComponent;
            }
            default: {
                return UnknownBlockComponent;
            }
        }
    }

    enrichBlock(block: BlockConfig): BlockConfig {
        return block;
    }
}
