import "./_dnt.polyfills.js";
import type { ParameterTransform, PolicySpec as WitPolicySpec, TypeEither, TypeFile, TypeFloat, TypeInteger, TypeList, TypeOptional, TypeString, TypeUnion } from "./gen/typegraph_core";
import type { FuncParams } from "./gen/typegraph_core";
import type { Materializer } from "./runtimes/mod.js";
import Policy, { PolicyPerEffectObject } from "./policy.js";
import { type AsIdField, type Base, type BaseEx } from "./utils/func_utils.js";
import type { InjectionValue } from "./utils/type_utils.js";
import { ApplyFromArg, ApplyFromContext, ApplyFromParent, ApplyFromSecret, ApplyFromStatic, type InheritDef } from "./typegraph.js";
export type PolicySpec = Policy | PolicyPerEffectObject | {
    none: Policy;
    create: Policy;
    update: Policy;
    delete: Policy;
};
export type Simplified<T> = Omit<T, "of">;
export type SimplifiedNumericData<T> = {
    enumeration?: number[];
} & Omit<T, "enumeration">;
export declare function getPolicyChain(policy: PolicySpec[] | PolicySpec): WitPolicySpec[];
export declare class Typedef {
    readonly _id: number;
    readonly name?: string;
    policy: WitPolicySpec[] | null;
    constructor(_id: number);
    get repr(): string | null;
    withPolicy(policy: PolicySpec[] | PolicySpec): this;
    rename(name: string): this;
    asTypedef(): Typedef;
    optional(data?: Simplified<TypeOptional>): Optional;
    /** inject value to type (serialized injection) */
    withInjection(injection: string): this;
    /** inject static value */
    set(value: InjectionValue<unknown>): this;
    /** inject value to type (generic source) */
    inject(value: InjectionValue<string>): this;
    /** inject value to type */
    fromContext(value: InjectionValue<string>): this;
    /** inject value from secret */
    fromSecret(value: InjectionValue<string>): this;
    /** inject value from parent */
    fromParent(value: InjectionValue<string>): this;
    /** inject random value */
    fromRandom(): this;
}
declare class Boolean extends Typedef {
    constructor(_id: number);
}
/** boolean type */
export declare function boolean(base?: Base): Boolean;
export declare class Integer extends Typedef implements Readonly<TypeInteger> {
    readonly min?: number;
    readonly max?: number;
    readonly exclusiveMinimum?: number;
    readonly exclusiveMaximum?: number;
    readonly multipleOf?: number;
    readonly enumeration?: Int32Array;
    constructor(_id: number, data: TypeInteger);
    id(asId?: AsIdField): Typedef;
}
/** integer type */
export declare function integer(data?: SimplifiedNumericData<TypeInteger>, base?: BaseEx): Integer;
declare class Float extends Typedef implements Readonly<TypeFloat> {
    readonly min?: number;
    readonly max?: number;
    readonly exclusiveMinimum?: number;
    readonly exclusiveMaximum?: number;
    readonly multipleOf?: number;
    readonly enumeration?: Float64Array;
    constructor(_id: number, data: TypeFloat);
}
/** floating-point type */
export declare function float(data?: SimplifiedNumericData<TypeFloat>, base?: Base): Float;
export declare class String extends Typedef implements Readonly<TypeString> {
    readonly min?: number;
    readonly max?: number;
    readonly format?: string;
    readonly pattern?: string;
    readonly enumeration?: string[];
    constructor(_id: number, data: TypeString);
    id(asId?: AsIdField): Typedef;
}
/** string type */
export declare function string(data?: TypeString, base?: BaseEx): String;
/** uuid type */
export declare function uuid(base?: BaseEx): String;
/** email type */
export declare function email(): String;
/** uri type */
export declare function uri(): String;
/** ean type */
export declare function ean(): String;
/** path type */
export declare function path(): String;
/** datetime type */
export declare function datetime(): String;
/** json type */
export declare function json(): String;
/** hostname type */
export declare function hostname(): String;
/** phone number type */
export declare function phone(): String;
/** string enum type */
export declare function enum_(variants: string[], base?: Base): String;
declare class File extends Typedef {
    readonly min?: number;
    readonly max?: number;
    readonly allow?: string[];
    constructor(_id: number, data: TypeFile);
}
/** file type */
export declare function file(data?: Simplified<TypeFile>, base?: Base): File;
export declare class List extends Typedef {
    readonly min?: number;
    readonly max?: number;
    readonly items?: number;
    readonly uniqueItems?: boolean;
    constructor(_id: number, data: TypeList);
}
/** list type */
export declare function list(variant: Typedef, data?: Simplified<TypeList>, base?: Base): List;
export declare class Optional extends Typedef {
    readonly item?: number;
    readonly defaultItem?: string;
    constructor(_id: number, data: TypeOptional);
}
/** optional type */
export declare function optional(variant: Typedef, data?: Simplified<TypeOptional>, base?: Base): Optional;
declare class Union extends Typedef {
    readonly variants: Array<number>;
    constructor(_id: number, data: TypeUnion);
}
/** union type */
export declare function union(variants: Array<Typedef>, base?: Base): Union;
declare class Either extends Typedef {
    readonly variants: Array<number>;
    constructor(_id: number, data: TypeEither);
}
/** either type */
export declare function either(variants: Array<Typedef>, base?: Base): Either;
export declare class Struct<P extends {
    [key: string]: Typedef;
}> extends Typedef {
    props: P;
    constructor(_id: number, { props }: {
        props: P;
    });
}
/** struct type */
export declare function struct<P extends {
    [key: string]: Typedef;
}>(props: P, { additionalProps, ...base }?: Base & {
    additionalProps?: boolean;
}): Struct<P>;
type ApplyParamObjectNode = {
    [key: string]: ApplyParamNode;
};
type ApplyParamArrayNode = Array<ApplyParamNode>;
type ApplyParamLeafNode = ApplyFromArg | ApplyFromStatic | ApplyFromContext | ApplyFromSecret | ApplyFromParent;
type ApplyParamNode = ApplyParamObjectNode | ApplyParamArrayNode | ApplyParamLeafNode;
export declare class Func<I extends Typedef = Typedef, O extends Typedef = Typedef, M extends Materializer = Materializer> extends Typedef {
    inp: I;
    out: O;
    mat: M;
    parameterTransform: ParameterTransform | null;
    config: FuncConfig | null;
    constructor(_id: number, inp: I, out: O, mat: M, parameterTransform?: ParameterTransform | null, config?: FuncConfig | null);
    extend(fields: Record<string, Typedef>): Func<I, Typedef, M>;
    /** reduce input type;
     * see [parameter transformations](https://metatype.dev/docs/reference/types/parameter-transformations)
     */
    reduce(value: Record<string, unknown | InheritDef>): Func;
    /** apply injections to the input type;
     * see [parameter transformations](https://metatype.dev/docs/reference/types/parameter-transformations)
     */
    apply(value: ApplyParamObjectNode): Func<Typedef, O, M>;
    /** set rate limiting configs */
    rate(inp: {
        calls: boolean;
        weight?: number;
    }): Func<I, O, M>;
    /** */
    static fromTypeFunc(data: FuncParams): Func;
}
type FuncConfig = {
    rateCalls?: boolean;
    rateWeight?: number;
};
/** function type */
export declare function func<I extends Typedef = Typedef, O extends Typedef = Typedef, M extends Materializer = Materializer>(inp: I, out: O, mat: M, transformData?: ParameterTransform | null, config?: FuncConfig | null): Func<I, O, M>;
export {};
