import * as z from 'zod';
import type { Tag } from './ownership';
export interface ResourceMeta {
    /** URI scheme, e.g. "content://doc/{id}" or "marketplace://offers/{city}/{tag}" */
    uriTemplate: string;
    /** Human title for discovery */
    title: string;
    /** Short description */
    description?: string;
    /** MIME type for resource body */
    mimeType: string;
    /** Tags for filtering/grouping */
    tags?: Tag[];
}
export interface ResourceTemplateSpec<I extends z.ZodType> {
    meta: ResourceMeta;
    /** Arguments to materialize the URI (zod validates input) */
    input: I;
    /**
     * Resolve returns the resource body and a resolved URI.
     * It MUST be read-only (no side effects).
     */
    resolve: (args: z.infer<I>, ctx: {
        userId?: string | null;
        orgId?: string | null;
        locale?: string;
    }) => Promise<{
        uri: string;
        mimeType?: string;
        data: Uint8Array | string;
    }>;
}
export declare function defineResourceTemplate<I extends z.ZodType>(spec: ResourceTemplateSpec<I>): ResourceTemplateSpec<I>;
export declare class ResourceRegistry {
    private templates;
    register<I extends z.ZodType>(tmpl: ResourceTemplateSpec<I>): this;
    listTemplates(): ResourceTemplateSpec<any>[];
    /** Try to match a concrete URI to a template by naive pattern substitution */
    match(uri: string): {
        tmpl: ResourceTemplateSpec<any>;
        params: Record<string, string>;
    } | undefined;
}
export interface ResourceRefDescriptor<Many extends boolean> {
    kind: 'resource_ref';
    /** URI template, e.g. 'strit://spot/{id}' */
    uriTemplate: string;
    /** Variable name inside result payload to substitute into template; defaults to 'id' */
    varName?: string;
    /** Optional GraphQL type name to use when exposing over GraphQL (e.g., 'Spot') */
    graphQLType: string;
    /** Cardinality: when present and true, the handler returns an array of resources */
    many: Many;
}
export declare function resourceRef<Many extends boolean>(uriTemplate: string, opts: {
    varName?: string;
    graphQLType: string;
    many: Many;
}): ResourceRefDescriptor<Many>;
export declare function isResourceRef(x: unknown): x is ResourceRefDescriptor<boolean>;
