import type { Creatable, CreatableInstance, CreatableParams, EventData, Labels, WithOptionalLabels } from '@ariestools/sdk';
import type { Provider, ProviderMoniker } from '@xyo-network/xl1-protocol/protocol-lib';
import type { Surface } from '../capabilities/Backing.js';
import type { ConnectionKind } from '../config/connections/Connection.js';
import type { CreatableProviderContext } from '../model/index.js';
/**
 * Connection modes declared on creatable provider statics.
 * `none` marks a provider that consumes no connection of its own.
 */
export type CreatableProviderConnectionType = ConnectionKind | 'none' | 'wallet';
import type { GetInstanceOptions } from './GetInstanceOptions.js';
import type { LabeledCreatableProviderFactory } from './LabeledCreatableProviderFactory.js';
/** Creation parameters shared by SDK providers. */
export interface CreatableProviderParams<TContext extends CreatableProviderContext = CreatableProviderContext> extends CreatableParams {
    /** Runtime context used for configuration and dependency resolution. */
    context: TContext;
}
/** Base event map emitted during a creatable provider's lifecycle. */
export interface CreatableProviderEventData extends EventData {
}
/** Created provider instance augmented with its resolved dependency map. */
export type CreatableProviderInstance<TProvider extends Provider<ProviderMoniker> = Provider<ProviderMoniker>, TDependencies extends ProviderMoniker[] = ProviderMoniker[], TParams extends CreatableProviderParams = CreatableProviderParams, TEventData extends CreatableProviderEventData = CreatableProviderEventData> = CreatableInstance<TParams, TEventData> & TProvider & {
    dependencies: ProviderMap<TDependencies[number]>;
};
/** Lifetime and sharing boundary for instances created by a provider factory. */
export type ProviderFactoryScope = 'global' | 'context' | 'local';
/** Factory that resolves dependencies and creates a labeled provider instance. */
export interface CreatableProviderFactory<T extends CreatableProviderInstance = CreatableProviderInstance, TDependencies extends ProviderMoniker[] = ProviderMoniker[]> extends Omit<CreatableProvider<T>, 'create' | 'createHandler' | 'paramsHandler'> {
    /** Connection kinds supported by this provider. */
    readonly connectionTypes?: readonly CreatableProviderConnectionType[];
    /** Provider class instantiated by this factory. */
    creatableProvider: CreatableProvider<T>;
    /** @deprecated params are being removed — providers self-resolve from context.config / context runtime homes */
    defaultParams: Partial<Omit<T['params'], 'context'>>;
    /** Provider monikers that must resolve before this provider can be created. */
    readonly dependencies: TDependencies;
    /** Labels used to distinguish provider instances with the same moniker. */
    labels?: Labels;
    /** Provider class name used in diagnostics and instance keys. */
    providerName: string;
    /** Moniker combined with labels for a uniquely addressable provider instance. */
    resolvedMoniker: string;
    /** Lifetime and sharing boundary for provider instances created by the factory. */
    scope: ProviderFactoryScope;
    /** Read, write, or mixed capability surface exposed by the provider. */
    readonly surface?: Surface;
    /** Process-local identity used to distinguish this factory registration. */
    uniqueId: symbol;
    /** Returns the matching provider instance, creating it when its scope permits. */
    getInstance(this: CreatableProviderFactory<T>, params: T['params'], options?: GetInstanceOptions): Promise<T>;
    /** Attempts to get instance and returns `undefined` when it cannot be resolved. */
    tryGetInstance(this: CreatableProviderFactory<T>, params: T['params'], options?: GetInstanceOptions): Promise<T | undefined>;
}
/** Provider class whose factories can be distinguished by labels. */
export interface LabeledCreatableProvider<T extends CreatableProviderInstance = CreatableProviderInstance, TDependencies extends ProviderMoniker[] = ProviderMoniker[]> extends CreatableProvider<T>, WithOptionalLabels {
    /** Creates a provider factory with the supplied dependencies and default parameters. */
    factory(dependencies: TDependencies, params?: Partial<Omit<T['params'], 'context'>>): LabeledCreatableProviderFactory<T>;
}
/** Resolved provider dependencies keyed by their monikers. */
export type ProviderMap<T extends ProviderMoniker = ProviderMoniker> = Partial<Record<T, CreatableProviderInstance<Provider<T>>>>;
/** Static contract implemented by provider classes that support asynchronous creation. */
export interface CreatableProvider<T extends CreatableProviderInstance = CreatableProviderInstance, TDependencies extends ProviderMoniker[] = ProviderMoniker[]> extends Creatable<T> {
    /** Connection kinds supported by this provider. */
    readonly connectionTypes?: readonly CreatableProviderConnectionType[];
    /** Primary moniker used to resolve this provider. */
    readonly defaultMoniker: ProviderMoniker;
    /** Provider monikers that must resolve before this provider can be created. */
    readonly dependencies: TDependencies;
    /** Provider monikers implemented by this provider class. */
    readonly monikers: ProviderMoniker[];
    /** Read, write, or mixed capability surface exposed by the provider. */
    readonly surface?: Surface;
    /** Creates a provider factory with the supplied dependencies and default parameters. */
    factory(dependencies: TDependencies, params?: Partial<Omit<T['params'], 'context'>>): CreatableProviderFactory<T>;
}
/**
 * Class annotation to be used to decorate Providers which support
 * an asynchronous creation pattern
 * @returns The decorated Provider requiring it implement the members
 * of the CreatableProvider as statics properties/methods
 */
export declare function creatableProvider<TProvider extends CreatableProviderInstance = CreatableProviderInstance>(): <U extends CreatableProvider<TProvider>>(constructor: U) => void;
/**
 * Class annotation to be used to decorate Providers which support
 * an asynchronous creation pattern
 * @returns The decorated Provider requiring it implement the members
 * of the CreatableProvider as statics properties/methods
 */
export declare function labeledCreatableProvider<TProvider extends CreatableProviderInstance = CreatableProviderInstance>(): <U extends LabeledCreatableProvider<TProvider>>(constructor: U) => void;
//# sourceMappingURL=CreatableProvider.d.ts.map