syntax = "proto3";

package jobs.v1;

option php_namespace = "Spiral\\RoadRunner\\Jobs\\DTO\\V1";

// single job request
message PushRequest {
    Job job = 1;
}

// batch jobs request
message PushBatchRequest {
    repeated Job jobs = 1;
}

// request to pause/resume/list/Destroy
message Pipelines {
    repeated string pipelines = 1;
}

// some endpoints receives nothing
// all endpoints returns nothing, except error
message Empty {}

message DeclareRequest {
    map<string, string> pipeline = 1;
}

message Job {
    string job = 1;
    string id = 2;
    string payload = 3;
    map<string, HeaderValue> headers = 4;
    Options options = 5;
    bool auto_ack = 6;
}

message Options {
    int64 priority = 1;
    string pipeline = 2;
    int64 delay = 3;
}

message HeaderValue {
    repeated string value = 1;
}

message Stats {
    repeated Stat Stats = 1;
}

// Stat used as a response for the Stats RPC call
message Stat {
    string pipeline = 1;
    string driver = 2;
    string queue = 3;
    int64 active = 4;
    int64 delayed = 5;
    int64 reserved = 6;
    bool ready = 7;
}
