syntax = "proto3";

package iop;

option go_package = "iop/proto/gen/iop";

enum JobStatus {
  JOB_STATUS_UNSPECIFIED = 0;
  JOB_STATUS_PENDING     = 1;
  JOB_STATUS_RUNNING     = 2;
  JOB_STATUS_COMPLETED   = 3;
  JOB_STATUS_FAILED      = 4;
  JOB_STATUS_CANCELLED   = 5;
}

message Job {
  string    job_id      = 1;
  string    run_id      = 2;
  string    node_id     = 3;
  string    adapter     = 4;
  string    target      = 5;
  JobStatus status      = 6;
  int64     created_at  = 7;
  int64     started_at  = 8;
  int64     finished_at = 9;
  string    error       = 10;
  map<string, string> metadata = 11;
}

message JobListRequest {
  JobStatus status_filter = 1;
  int32     limit         = 2;
  string    cursor        = 3;
}

message JobListResponse {
  repeated Job jobs  = 1;
  string       next  = 2;
}
