import z from 'zod';
import * as Generator from '@postxl/generator';
import { NestJSModule, WithBackend } from '../backend-core';
import { WithDatabase } from '../backend-database-prisma';
import { WithBase } from '../base';
import { WithTypes } from '../types';
type ContextRequirements = WithBackend<WithDatabase<WithTypes<WithBase<Generator.Context>>>>;
export type ContextResult = WithActions<ContextRequirements>;
export type WithActions<Context> = Generator.ExtendContext<Context, {
    actions: ActionsContext;
}>;
export type ActionsContext = {
    module: Generator.ImportableItem;
    config: Generator.ImportableClass & {
        /**
         * Type describing the options to construct the config
         */
        options: Generator.ImportableType;
    };
    /**
     * Dispatcher service
     */
    readonly dispatcher: Generator.ImportableClass;
    /**
     * Authorization service used before dispatching actions
     */
    readonly authorization: {
        readonly service: Generator.ImportableClass;
    };
    /**
     * The class that executes the actions
     */
    readonly execution: {
        /**
         * Interface for the action execution
         */
        readonly interface: Generator.ImportableType & {
            actionOperationId: Generator.ImportableType;
            toBrandedActionOperationId: Generator.ImportableFunction;
        };
        /**
         * The class that executes the actions
         */
        readonly class: Generator.ImportableClass;
        /**
         * Internal name of the execution class.
         */
        _internalName: Generator.ClassName;
        /**
         * Name of the mutation start and finish functions
         */
        mutations: {
            create: MutationFunctions;
            createMany: MutationFunctions;
            update: MutationFunctions;
            updateMany: MutationFunctions;
            delete: MutationFunctions;
            deleteMany: MutationFunctions;
            clone: MutationFunctions;
        };
        /**
         * Name of the transformation start and finish function
         */
        transformation: MutationFunctions & {
            executeSingle: Generator.FunctionName;
            executeMultiple: Generator.FunctionName;
        };
        errorOperation: Generator.FunctionName;
    };
    /**
     * The individual providers from other modules that provide actions.
     * This will be populated by other backend modules during the registration
     *
     * This is used to generate the action types and results in actions.types.ts
     */
    providers: ActionProvider<any>[];
    /**
     * The combined action type that includes all actions provided by the providers
     */
    readonly summary: ActionProviderTypes & {
        /**
         * Helper type to extract the result based on the action type
         */
        readonly resultOfActionHelper: Generator.ImportableType;
    };
};
type MutationFunctions = {
    start: Generator.FunctionName;
    finish: Generator.FunctionName;
};
/**
 * Other backend modules can provide actions. These need to be registered as providers in the actions module.
 */
export type ActionProvider<Actions extends Record<string, ActionProviderTypes>> = {
    module: NestJSModule;
    service: Generator.ImportableClass & {
        /**
         * Name of the service variable in the dispatcher service
         */
        variableName: Generator.VariableName;
    };
    scopes: Set<ScopeName>;
    actions: {
        summary: ActionProviderTypes;
    } & Actions;
};
declare const zScopeName: z.core.$ZodBranded<z.ZodString, "PXL.ScopeName", "out">;
/**
 * A scope name that is used to refer to the scope of actions (e.g. `Seed`, `User`, `Aggregation`)
 */
export type ScopeName = z.infer<typeof zScopeName>;
export declare const toScopeName: (input: string) => string & z.core.$brand<"PXL.ScopeName">;
/**
 * Relevant information to aggregate the action types and results
 */
export type ActionProviderTypes = {
    /**
     * Type that defines all actions provided, e.g. `Action_BusinessLogic`, `Action_Seed`, `Action_Import`
     *
     * This type is usually a union of all actions provided by the module.
     */
    readonly action: Generator.ImportableType;
    /**
     * Type that defines the action results of the provided actions, e.g. `ActionResult_BusinessLogic`, `ActionResult_Seed`, `ActionResult_Import`
     */
    readonly result: Generator.ImportableType;
};
export declare const generatorId: string & z.core.$brand<"PXL.GeneratorInterfaceId">;
export declare const generator: Generator.GeneratorInterface;
export {};
