import { Type } from '@angular/core';

export interface QueryDecorator {
    (props: {
        class?: Array<string>;
    }): any;
    new(props: {
        class?: Array<string>;
    }): any;
}

export function Query(queryMetadata: {
    class?: Array<string>;
} = {}): any {
    return (type: Type<any>) => {
        const ANNOTATIONS = '__annotations__';
        type[ANNOTATIONS] = type[ANNOTATIONS] || [];
        type[ANNOTATIONS].push(queryMetadata);
    };
}

export function Root(): any {
    return (type: Type<any>) => {
        const ANNOTATIONS = '__annotations__';
        type[ANNOTATIONS] = type[ANNOTATIONS] || [];
        type[ANNOTATIONS].push({ class: [] });
    };
}
