syntax = "proto3";

package main;

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

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

service Catalog {
  rpc GetUpcoming(AuctionSearchCriteria) returns (GetUpcomingResult) {
    option (google.api.http) = {
      get: "/v1/upcoming"
    };
  }

  // rpc ImportAuction(ImportAuctionMessage) returns (AuctionCreated) {
  // }
}

message AuctionSearchCriteria {
  string searchTerm = 1;
  int32 page = 3;
  int32 limit = 4;
}

message GetUpcomingResult {
  int32 page = 1;
  int32 total = 2;
  int32 found = 3;
	repeated Auction results = 4;
}

message Auction {
  int32 id = 1;
  string fingerprint = 2;
  int32 items = 3;
  google.protobuf.Timestamp start = 4;
  google.protobuf.Timestamp end = 5;
  string title = 6;
  string description = 7;
  string sourceSiteURL = 8;
  string sourceSiteName = 9;
  string sourceURL = 10;
  string country = 11;
  string province = 12;
}

message ImportAuctionMessage {
  int32 items = 1;
  google.protobuf.Timestamp start = 2;
  google.protobuf.Timestamp end = 3;
  string title = 4;
  string description = 5;
  string sourceSiteURL = 6;
  string sourceSiteName = 7;
  string sourceURL = 8;
  string country = 9;
  string province = 10;
}

message AuctionCreated {
  bool duplicate = 1;
  Auction auction = 2;
}
