import { PolicySpec as WitPolicySpec, TypeBase, TypeEither, TypeFile, TypeFloat, TypeInteger, TypeList, TypeOptional, TypeString, TypeUnion } from "./gen/interfaces/metatype-typegraph-core.js";
import { FuncParams } from "./gen/interfaces/metatype-typegraph-runtimes.js";
import { Materializer } from "./runtimes/mod.js";
import Policy, { PolicyPerEffectObject } from "./policy.js";
import { InjectionValue } from "./utils/type_utils.js";
import { 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 SimplifiedBase<T> = {
    config?: Record<string, unknown>;
} & Omit<T, "runtimeConfig" | "asId">;
export type AsId = {
    asId?: true;
};
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;
    readonly runtimeConfig?: Array<[string, string]>;
    policy: Policy[] | null;
    constructor(_id: number, base: Omit<TypeBase, "asId">);
    get repr(): string | null;
    withPolicy(policy: PolicySpec[] | PolicySpec): this;
    rename(name: string): this;
    asTypedef(): Typedef;
    optional(data?: Simplified<TypeOptional>): Optional;
    withInjection(injection: string): this;
    set(value: InjectionValue<unknown>): this;
    inject(value: InjectionValue<string>): this;
    fromContext(value: InjectionValue<string>): this;
    fromSecret(value: InjectionValue<string>): this;
    fromParent(value: InjectionValue<string>): this;
}
declare class Boolean extends Typedef {
    constructor(_id: number, base: TypeBase);
}
export declare function boolean(base?: SimplifiedBase<TypeBase>): Boolean;
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, base: TypeBase);
}
export declare function integer(data?: SimplifiedNumericData<TypeInteger>, base?: SimplifiedBase<TypeBase> & AsId): 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, base: TypeBase);
}
export declare function float(data?: SimplifiedNumericData<TypeFloat>, base?: SimplifiedBase<TypeBase>): Float;
declare class StringT 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, base: TypeBase);
}
export declare function string(data?: TypeString, base?: SimplifiedBase<TypeBase> & AsId): StringT;
export declare function uuid(base?: SimplifiedBase<TypeBase> & AsId): StringT;
export declare function email(): StringT;
export declare function uri(): StringT;
export declare function ean(): StringT;
export declare function path(): StringT;
export declare function datetime(): StringT;
export declare function enum_(variants: string[], base?: SimplifiedBase<TypeBase>): StringT;
declare class File extends Typedef {
    readonly min?: number;
    readonly max?: number;
    readonly allow?: string[];
    constructor(_id: number, data: TypeFile, base: TypeBase);
}
export declare function file(data?: Simplified<TypeFile>, base?: SimplifiedBase<TypeBase>): File;
declare class List extends Typedef {
    readonly min?: number;
    readonly max?: number;
    readonly items?: number;
    readonly uniqueItems?: boolean;
    constructor(_id: number, data: TypeList, base: TypeBase);
}
export declare function list(variant: Typedef, data?: Simplified<TypeList>, base?: SimplifiedBase<TypeBase>): List;
declare class Optional extends Typedef {
    readonly item?: number;
    readonly defaultItem?: string;
    constructor(_id: number, data: TypeOptional, base: TypeBase);
}
export declare function optional(variant: Typedef, data?: Simplified<TypeOptional>, base?: SimplifiedBase<TypeBase>): Optional;
declare class Union extends Typedef {
    readonly variants: Array<number>;
    constructor(_id: number, data: TypeUnion, base: TypeBase);
}
export declare function union(variants: Array<Typedef>, base?: SimplifiedBase<TypeBase>): Union;
declare class Either extends Typedef {
    readonly variants: Array<number>;
    constructor(_id: number, data: TypeEither, base: TypeBase);
}
export declare function either(variants: Array<Typedef>, base?: SimplifiedBase<TypeBase>): Either;
export declare class Struct<P extends {
    [key: string]: Typedef;
}> extends Typedef {
    props: P;
    constructor(_id: number, { props }: {
        props: P;
    }, base: TypeBase);
}
export declare function struct<P extends {
    [key: string]: Typedef;
}>(props: P, base?: SimplifiedBase<TypeBase>): Struct<P>;
export declare class Func<P extends {
    [key: string]: Typedef;
} = Record<string, Typedef>, I extends Struct<P> = Struct<P>, O extends Typedef = Typedef, M extends Materializer = Materializer> extends Typedef {
    inp: I;
    out: O;
    mat: M;
    constructor(_id: number, inp: I, out: O, mat: M);
    reduce(value: Record<string, unknown | InheritDef>): Func<{
        [key: string]: Typedef;
    }, Struct<P>, O, M>;
    rate(inp: {
        calls: boolean;
        weight?: number;
    }): Func<P, I, O, M>;
    static fromTypeFunc(data: FuncParams): Func<{
        [key: string]: Typedef;
    }, Struct<{
        [key: string]: Typedef;
    }>, Typedef, {
        _id: number;
    }>;
}
type FuncConfig = {
    rateCalls?: boolean;
    rateWeight?: number;
};
export declare function func<P extends {
    [key: string]: Typedef;
}, I extends Struct<P> = Struct<P>, O extends Typedef = Typedef, M extends Materializer = Materializer>(inp: I, out: O, mat: M, { rateCalls, rateWeight }?: FuncConfig): Func<P, I, O, M>;
export {};
