import { StubContext, StubContextMutator } from "../core/StubContext";
import { StubMethodConfig } from "../types";


export function StubMethod(config?: StubMethodConfig): MethodDecorator {

    const props = config ?? {
        
    };

    return (target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<any>) => {

        const ctx = StubContext.getContext(props.contextDomain) as StubContextMutator;

        return ctx.defineMember(
            props,
            target,
            propertyKey,
            descriptor
        );
    }
}