import { Inngest, GetEvents, ClientOptions } from 'inngest';
import { AnyInngest } from 'inngest/components/Inngest';
import { Context } from 'inngest/types';
import { NestModule, MiddlewareConsumer } from '@nestjs/common';
import { DiscoveryService, DiscoveryModule } from '@golevelup/nestjs-discovery';

type ExtractClientOptions<T> = T extends Inngest<infer I> ? I : never;

type ExtractInngest<T> = T extends NestInngest<infer I> ? I : never;
declare class NestInngest<TInngest extends AnyInngest> {
    protected readonly inngest: TInngest;
    constructor(inngest: TInngest);
    static from<TOpts extends AnyInngest>(inngest: TOpts): NestInngest<TOpts>;
    /**
     * Inngest function decorator
     */
    Function(args: Parameters<TInngest["createFunction"]>[0]): (target: Object, key: string | symbol, descriptor: PropertyDescriptor) => PropertyDescriptor;
    /**
     * Inngest function trigger decorator
     */
    Trigger(options: Parameters<TInngest["createFunction"]>[1]): (target: Object, key: string | symbol, descriptor: PropertyDescriptor) => TypedPropertyDescriptor<(ctx: Context<ExtractClientOptions<TInngest>, GetEvents<TInngest>, Parameters<TInngest["createFunction"]>[1]["event"] extends keyof GetEvents<TInngest> & string ? Parameters<TInngest["createFunction"]>[1]["event"] : any>) => any>;
}
declare namespace NestInngest {
    type context<TInngest, TEvent extends keyof GetEvents<ExtractInngest<TInngest>> & string, TOpts extends ClientOptions = ExtractClientOptions<ExtractInngest<TInngest>>> = Context<TOpts, GetEvents<ExtractInngest<TInngest>>, TEvent>;
}

declare const INNGEST_KEY: "INNGEST";
declare const INNGEST_OPTIONS: "INNGEST_OPTIONS";
declare const INNGEST_FUNCTION: "INNGEST_FUNCTION";
declare const INNGEST_TRIGGER: "INNGEST_TRIGGER";
interface InngestModuleOptions {
    /**
     * Inngest client instance
     */
    inngest: AnyInngest;
    /**
     * Path that inngest will be listening
     * @default "/api/inngest"
     */
    path?: string;
}
declare class InngestModule implements NestModule {
    private readonly discover;
    private readonly inngest;
    private readonly options;
    constructor(discover: DiscoveryService, inngest: Inngest, options: Omit<InngestModuleOptions, "inngest">);
    static forRoot({ inngest, ...options }: InngestModuleOptions): {
        imports: (typeof DiscoveryModule)[];
        module: typeof InngestModule;
        providers: ({
            provide: "INNGEST";
            useValue: AnyInngest;
        } | {
            provide: "INNGEST_OPTIONS";
            useValue: {
                /**
                 * Path that inngest will be listening
                 * @default "/api/inngest"
                 */
                path?: string | undefined;
            };
        })[];
        exports: never[];
        global: boolean;
    };
    configure(consumer: MiddlewareConsumer): Promise<void>;
}

export { ExtractClientOptions, ExtractInngest, INNGEST_FUNCTION, INNGEST_KEY, INNGEST_OPTIONS, INNGEST_TRIGGER, InngestModule, InngestModuleOptions, NestInngest };
