import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import type { CallContext, CallOptions } from "nice-grpc-common";
import type { FileDescriptorProto as FileDescriptorProto1 } from "ts-proto-descriptors";
import { Attribute } from "./attribute";
import { Subject } from "./auth";
import { FilterOp } from "./filter";
import { Meta } from "./meta";
import { DeleteRequest, DeleteResponse, ReadRequest } from "./resource_base";
import { OperationStatus, Status } from "./status";
export declare const protobufPackage = "io.restorecommerce.rule";
/** Resulting effect from a Policy or Rule. */
export declare enum Effect {
    PERMIT = "PERMIT",
    DENY = "DENY",
    UNRECOGNIZED = "UNRECOGNIZED"
}
export declare function effectFromJSON(object: any): Effect;
export declare function effectToJSON(object: Effect): string;
export declare function effectToNumber(object: Effect): number;
/** Target specified by a Rule or a Request. */
export interface Target {
    subjects?: Attribute[] | undefined;
    resources?: Attribute[] | undefined;
    actions?: Attribute[] | undefined;
}
export interface Rule {
    id?: string | undefined;
    meta?: Meta | undefined;
    name?: string | undefined;
    description?: string | undefined;
    target?: Target | undefined;
    context_query?: ContextQuery | undefined;
    /** JS code */
    condition?: string | undefined;
    effect?: Effect | undefined;
    evaluation_cacheable?: boolean | undefined;
}
/** used for `whatIsAllowed` / reverse queries */
export interface RuleRQ {
    id?: string | undefined;
    target?: Target | undefined;
    effect?: Effect | undefined;
    condition?: string | undefined;
    context_query?: ContextQuery | undefined;
    evaluation_cacheable?: boolean | undefined;
}
export interface RuleList {
    items?: Rule[] | undefined;
    total_count?: number | undefined;
    subject?: Subject | undefined;
}
export interface RuleListResponse {
    items?: RuleResponse[] | undefined;
    total_count?: number | undefined;
    operation_status?: OperationStatus | undefined;
}
export interface RuleResponse {
    payload?: Rule | undefined;
    status?: Status | undefined;
}
/**
 * Query to pull resources from an external service
 *  and append them to the request's context.
 * The retrieved data can then be passed onto the request's context
 */
export interface ContextQuery {
    filters?: FilterOp[] | undefined;
    query?: string | undefined;
}
export declare const Target: MessageFns<Target>;
export declare const Rule: MessageFns<Rule>;
export declare const RuleRQ: MessageFns<RuleRQ>;
export declare const RuleList: MessageFns<RuleList>;
export declare const RuleListResponse: MessageFns<RuleListResponse>;
export declare const RuleResponse: MessageFns<RuleResponse>;
export declare const ContextQuery: MessageFns<ContextQuery>;
export type RuleServiceDefinition = typeof RuleServiceDefinition;
export declare const RuleServiceDefinition: {
    readonly name: "RuleService";
    readonly fullName: "io.restorecommerce.rule.RuleService";
    readonly methods: {
        readonly read: {
            readonly name: "Read";
            readonly requestType: typeof ReadRequest;
            readonly requestStream: false;
            readonly responseType: typeof RuleListResponse;
            readonly responseStream: false;
            readonly options: {
                readonly _unknownFields: {
                    readonly 248008: readonly [Buffer<ArrayBufferLike>];
                };
            };
        };
        readonly create: {
            readonly name: "Create";
            readonly requestType: typeof RuleList;
            readonly requestStream: false;
            readonly responseType: typeof RuleListResponse;
            readonly responseStream: false;
            readonly options: {};
        };
        readonly delete: {
            readonly name: "Delete";
            readonly requestType: typeof DeleteRequest;
            readonly requestStream: false;
            readonly responseType: typeof DeleteResponse;
            readonly responseStream: false;
            readonly options: {};
        };
        readonly update: {
            readonly name: "Update";
            readonly requestType: typeof RuleList;
            readonly requestStream: false;
            readonly responseType: typeof RuleListResponse;
            readonly responseStream: false;
            readonly options: {};
        };
        readonly upsert: {
            readonly name: "Upsert";
            readonly requestType: typeof RuleList;
            readonly requestStream: false;
            readonly responseType: typeof RuleListResponse;
            readonly responseStream: false;
            readonly options: {};
        };
    };
};
export interface RuleServiceImplementation<CallContextExt = {}> {
    read(request: ReadRequest, context: CallContext & CallContextExt): Promise<DeepPartial<RuleListResponse>>;
    create(request: RuleList, context: CallContext & CallContextExt): Promise<DeepPartial<RuleListResponse>>;
    delete(request: DeleteRequest, context: CallContext & CallContextExt): Promise<DeepPartial<DeleteResponse>>;
    update(request: RuleList, context: CallContext & CallContextExt): Promise<DeepPartial<RuleListResponse>>;
    upsert(request: RuleList, context: CallContext & CallContextExt): Promise<DeepPartial<RuleListResponse>>;
}
export interface RuleServiceClient<CallOptionsExt = {}> {
    read(request: DeepPartial<ReadRequest>, options?: CallOptions & CallOptionsExt): Promise<RuleListResponse>;
    create(request: DeepPartial<RuleList>, options?: CallOptions & CallOptionsExt): Promise<RuleListResponse>;
    delete(request: DeepPartial<DeleteRequest>, options?: CallOptions & CallOptionsExt): Promise<DeleteResponse>;
    update(request: DeepPartial<RuleList>, options?: CallOptions & CallOptionsExt): Promise<RuleListResponse>;
    upsert(request: DeepPartial<RuleList>, options?: CallOptions & CallOptionsExt): Promise<RuleListResponse>;
}
type ProtoMetaMessageOptions = {
    options?: {
        [key: string]: any;
    };
    fields?: {
        [key: string]: {
            [key: string]: any;
        };
    };
    oneof?: {
        [key: string]: {
            [key: string]: any;
        };
    };
    nested?: {
        [key: string]: ProtoMetaMessageOptions;
    };
};
export interface ProtoMetadata {
    fileDescriptor: FileDescriptorProto1;
    references: {
        [key: string]: any;
    };
    dependencies?: ProtoMetadata[];
    options?: {
        options?: {
            [key: string]: any;
        };
        services?: {
            [key: string]: {
                options?: {
                    [key: string]: any;
                };
                methods?: {
                    [key: string]: {
                        [key: string]: any;
                    };
                };
            };
        };
        messages?: {
            [key: string]: ProtoMetaMessageOptions;
        };
        enums?: {
            [key: string]: {
                options?: {
                    [key: string]: any;
                };
                values?: {
                    [key: string]: {
                        [key: string]: any;
                    };
                };
            };
        };
    };
}
export declare const protoMetadata: ProtoMetadata;
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
export type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
    [K in keyof T]?: DeepPartial<T[K]>;
} : Partial<T>;
export interface MessageFns<T> {
    encode(message: T, writer?: BinaryWriter): BinaryWriter;
    decode(input: BinaryReader | Uint8Array, length?: number): T;
    fromJSON(object: any): T;
    toJSON(message: T): unknown;
    create(base?: DeepPartial<T>): T;
    fromPartial(object: DeepPartial<T>): T;
}
export {};
//# sourceMappingURL=rule.d.ts.map