syntax = "proto3";

package main;

import "google/protobuf/timestamp.proto";
import "google/api/annotations.proto";

option go_package = "git.vdhsn.com/barretthousen/barretthousen/src/runner/api/grpc";

service Runner {
  rpc StartSync(SyncParameters) returns (SyncStatus) {
    option (google.api.http) = {
      put: "/v1/sync"
      body: "*"
    };
  }

  rpc Status(StatusFilter) returns (SyncStatusList) {
    option (google.api.http) = {
      get: "/v1/sync"
    };
  }
}

message SyncParameters {
  string targetSite = 1;
}

message SyncStatus {
	int32 id = 1;
	google.protobuf.Timestamp createdTs = 2;
	google.protobuf.Timestamp completedTs = 3;
	int32 auctionsFound = 4;
	string targetSiteName = 5;
	string errors = 6;
}

message StatusFilter {
  int32 page = 1;
  int32 id = 2;
}

message SyncStatusList {
	repeated SyncStatus results = 1;
  int32 page = 2;
  int32 total = 3;
}
