import {
    createSelector,
    createFeatureSelector,
} from '@ngrx/store';

import { State } from '../reducers';

import * as fromBlock from '../reducers/block.reducer';

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

import { namespace } from '../../constants';

// -----------------
// --- feature selector
const get@module.class.name@State = createFeatureSelector<State>(namespace);

// -----------------
// ----- block
const getBlockState = createSelector(get@module.class.name@State, state => {
    return state.block;
});

export const getBlockById = (id: string) => {
    return createSelector(
        getBlockState,
        fromBlock.getEntityById(id),
    );
};
