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 { Any } from "../../google/protobuf/any";
import { Subject } from "./auth";
import { Meta } from "./meta";
import { DeleteRequest, DeleteResponse, FieldFilter } from "./resource_base";
import { OperationStatus, Status } from "./status";
export declare const protobufPackage = "io.restorecommerce.job";
/**
 * A Kafka event.
 * Send when a job resource got deleted.
 */
export interface Deleted {
    id?: string | undefined;
}
/** A list of jobs. */
export interface JobList {
    items?: Job[] | undefined;
    total_count?: number | undefined;
    subject?: Subject | undefined;
}
export interface JobListResponse {
    items?: JobResponse[] | undefined;
    total_count?: number | undefined;
    operation_status?: OperationStatus | undefined;
}
export interface JobResponse {
    payload?: Job | undefined;
    status?: Status | undefined;
}
/** A Job resource */
export interface Job {
    /** Job ID */
    id?: string | undefined;
    /** Job type */
    type?: string | undefined;
    /** Job-specific data with variable payload */
    data?: Data | undefined;
    /** Queue name to which the job should be added to */
    queue_name?: string | undefined;
    /** Used to specify the time at which the job is run */
    when?: string | undefined;
    /** The job options */
    options?: JobOptions | undefined;
}
/** Job Options */
export interface JobOptions {
    /** Job priority */
    priority?: JobOptions_Priority | undefined;
    /** Amount of possible failing runs until job fails */
    attempts?: number | undefined;
    /** Delay settings between failed job runs */
    backoff?: Backoff | undefined;
    /** The number of milliseconds after which the job should be fail with a timeout error */
    timeout?: number | undefined;
    /** Used for periodic jobs */
    repeat?: Repeat | undefined;
    /** To override the job ID - by default, the job ID is a unique generated by bull */
    jobId?: string | undefined;
    /** If true, removes the job when it successfully completes */
    removeOnComplete?: boolean | undefined;
}
export declare enum JobOptions_Priority {
    NORMAL = "NORMAL",
    LOW = "LOW",
    MEDIUM = "MEDIUM",
    HIGH = "HIGH",
    CRITICAL = "CRITICAL",
    UNRECOGNIZED = "UNRECOGNIZED"
}
export declare function jobOptions_PriorityFromJSON(object: any): JobOptions_Priority;
export declare function jobOptions_PriorityToJSON(object: JobOptions_Priority): string;
export declare function jobOptions_PriorityToNumber(object: JobOptions_Priority): number;
export interface Repeat {
    every?: number | undefined;
    cron?: string | undefined;
    startDate?: string | undefined;
    endDate?: string | undefined;
    count?: number | undefined;
    /** To override the job ID - by default, the job ID is a unique generated by bull */
    jobId?: string | undefined;
    /** time zone */
    tz?: string | undefined;
}
/** Data which is stored within a job instance */
export interface Data {
    /** optional variable payload */
    payload?: Any | undefined;
    meta?: Meta | undefined;
    /** id of job creator */
    subject_id?: string | undefined;
}
/**
 * A scheduled Job.
 * Emitted to Kafka by the scheduling service with event name 'queuedJob' and retreived by a service which processes this job.
 */
export interface ScheduledJob {
    /** Job instance ID */
    id?: string | undefined;
    type?: string | undefined;
    /** Job-specific data with variable payload */
    data?: Data | undefined;
    /** Type of schedule (ONCE, RECURR, etc) */
    schedule_type?: string | undefined;
}
/**
 * A finished scheduled Job.
 * Emitted to Kafka by the service which processed the job with event name 'done' and retrieved by the scheduling service.
 */
export interface JobDone {
    /** Job instance ID */
    id?: string | undefined;
    /** Type of schedule (ONCE, RECURR, etc) */
    schedule_type?: string | undefined;
    /** Whether to delete scheduled job */
    delete_scheduled?: boolean | undefined;
    /** Job type */
    type?: string | undefined;
    result?: Any | undefined;
}
/**
 * A failed scheduled Job event from the Job Service.
 * Emitted to Kafka by the service which processed the Job and retrieved by the scheduling service.
 */
export interface JobFailed {
    /** Job instance ID */
    id?: string | undefined;
    /** Error message */
    error?: string | undefined;
    /** Type of job ex: ONCE, RECURR etc. */
    schedule_type?: string | undefined;
    /** Job type */
    type?: string | undefined;
}
/** Delay between retries. */
export interface Backoff {
    /** Time until retry in milliseconds */
    delay?: number | undefined;
    /** Calculation of the delay */
    type?: Backoff_Type | undefined;
}
export declare enum Backoff_Type {
    /** FIXED - Retry with the same delay */
    FIXED = "FIXED",
    /** EXPONENTIAL - Exponential delay increase between retries */
    EXPONENTIAL = "EXPONENTIAL",
    UNRECOGNIZED = "UNRECOGNIZED"
}
export declare function backoff_TypeFromJSON(object: any): Backoff_Type;
export declare function backoff_TypeToJSON(object: Backoff_Type): string;
export declare function backoff_TypeToNumber(object: Backoff_Type): number;
/** Job-specific read request */
export interface JobReadRequest {
    limit?: number | undefined;
    sort?: JobReadRequest_SortOrder | undefined;
    /** Filter based on fieldName|operation, value|list */
    filter?: JobFilter | undefined;
    /** Fields selector */
    fields?: FieldFilter[] | undefined;
    subject?: Subject | undefined;
}
/** only possible to sort jobs by creation date */
export declare enum JobReadRequest_SortOrder {
    UNSORTED = "UNSORTED",
    ASCENDING = "ASCENDING",
    DESCENDING = "DESCENDING",
    UNRECOGNIZED = "UNRECOGNIZED"
}
export declare function jobReadRequest_SortOrderFromJSON(object: any): JobReadRequest_SortOrder;
export declare function jobReadRequest_SortOrderToJSON(object: JobReadRequest_SortOrder): string;
export declare function jobReadRequest_SortOrderToNumber(object: JobReadRequest_SortOrder): number;
/** filter */
export interface JobFilter {
    job_ids?: string[] | undefined;
    type?: string | undefined;
}
export declare const Deleted: MessageFns<Deleted>;
export declare const JobList: MessageFns<JobList>;
export declare const JobListResponse: MessageFns<JobListResponse>;
export declare const JobResponse: MessageFns<JobResponse>;
export declare const Job: MessageFns<Job>;
export declare const JobOptions: MessageFns<JobOptions>;
export declare const Repeat: MessageFns<Repeat>;
export declare const Data: MessageFns<Data>;
export declare const ScheduledJob: MessageFns<ScheduledJob>;
export declare const JobDone: MessageFns<JobDone>;
export declare const JobFailed: MessageFns<JobFailed>;
export declare const Backoff: MessageFns<Backoff>;
export declare const JobReadRequest: MessageFns<JobReadRequest>;
export declare const JobFilter: MessageFns<JobFilter>;
/**
 * The microservice for scheduling jobs.
 * Provides CRUD operations.
 */
export type JobServiceDefinition = typeof JobServiceDefinition;
export declare const JobServiceDefinition: {
    readonly name: "JobService";
    readonly fullName: "io.restorecommerce.job.JobService";
    readonly methods: {
        readonly read: {
            readonly name: "Read";
            readonly requestType: typeof JobReadRequest;
            readonly requestStream: false;
            readonly responseType: typeof JobListResponse;
            readonly responseStream: false;
            readonly options: {
                readonly _unknownFields: {
                    readonly 248008: readonly [Buffer<ArrayBufferLike>];
                };
            };
        };
        readonly create: {
            readonly name: "Create";
            readonly requestType: typeof JobList;
            readonly requestStream: false;
            readonly responseType: typeof JobListResponse;
            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 JobList;
            readonly requestStream: false;
            readonly responseType: typeof JobListResponse;
            readonly responseStream: false;
            readonly options: {};
        };
        readonly upsert: {
            readonly name: "Upsert";
            readonly requestType: typeof JobList;
            readonly requestStream: false;
            readonly responseType: typeof JobListResponse;
            readonly responseStream: false;
            readonly options: {};
        };
    };
};
export interface JobServiceImplementation<CallContextExt = {}> {
    read(request: JobReadRequest, context: CallContext & CallContextExt): Promise<DeepPartial<JobListResponse>>;
    create(request: JobList, context: CallContext & CallContextExt): Promise<DeepPartial<JobListResponse>>;
    delete(request: DeleteRequest, context: CallContext & CallContextExt): Promise<DeepPartial<DeleteResponse>>;
    update(request: JobList, context: CallContext & CallContextExt): Promise<DeepPartial<JobListResponse>>;
    upsert(request: JobList, context: CallContext & CallContextExt): Promise<DeepPartial<JobListResponse>>;
}
export interface JobServiceClient<CallOptionsExt = {}> {
    read(request: DeepPartial<JobReadRequest>, options?: CallOptions & CallOptionsExt): Promise<JobListResponse>;
    create(request: DeepPartial<JobList>, options?: CallOptions & CallOptionsExt): Promise<JobListResponse>;
    delete(request: DeepPartial<DeleteRequest>, options?: CallOptions & CallOptionsExt): Promise<DeleteResponse>;
    update(request: DeepPartial<JobList>, options?: CallOptions & CallOptionsExt): Promise<JobListResponse>;
    upsert(request: DeepPartial<JobList>, options?: CallOptions & CallOptionsExt): Promise<JobListResponse>;
}
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=job.d.ts.map