syntax = "proto3";

package worldmonitor.prediction.v1;

import "sebuf/http/annotations.proto";
import "worldmonitor/core/v1/pagination.proto";
import "worldmonitor/prediction/v1/prediction_market.proto";

// ListPredictionMarketsRequest specifies filters for retrieving prediction markets.
message ListPredictionMarketsRequest {
  // Maximum items per page (1-100).
  int32 page_size = 1 [(sebuf.http.query) = { name: "page_size" }];
  // Cursor for next page.
  // Accepted but currently ignored; no-op until this handler supports the parameter.
  string cursor = 2 [(sebuf.http.query) = { name: "cursor" }, (sebuf.http.unimplemented) = true];
  // Optional category filter (e.g., "Politics").
  string category = 3 [(sebuf.http.query) = { name: "category" }];
  // Optional search query for market titles.
  string query = 4 [(sebuf.http.query) = { name: "query" }];
}

// ListPredictionMarketsResponse contains prediction markets matching the request.
message ListPredictionMarketsResponse {
  // The list of prediction markets.
  repeated PredictionMarket markets = 1;
  // Pagination metadata.
  worldmonitor.core.v1.PaginationResponse pagination = 2;
  // Time the seed snapshot was fetched, as Unix epoch milliseconds. A value of
  // 0 means the snapshot is unavailable/degraded, not that there are confirmed
  // zero matching markets.
  int64 fetched_at = 3 [(sebuf.http.int64_encoding) = INT64_ENCODING_NUMBER];
  // True when markets were evaluated against a seed snapshot. False means an
  // empty payload is graceful degradation because the snapshot is unavailable.
  bool data_available = 4;
}
