syntax = "proto3";

package datacube;

// Query request sent from client to datacube
message QueryRequest {
  // List of providers to query (empty = all applicable)
  repeated string providers = 1;
  // The search query string
  string query = 2;
  // Maximum number of results to return
  int32 max_results = 3;
  // Whether to require exact matches only
  bool exact = 4;
}

// Query response containing matched items
message QueryResponse {
  // The original query string
  string query = 1;
  // List of matched items
  repeated Item items = 2;
  // Query ID for tracking
  string qid = 3;
}

// A single result item
message Item {
  // Unique identifier for this item
  string id = 1;
  // Primary display text (e.g., app name)
  string text = 2;
  // Secondary display text (e.g., description)
  string subtext = 3;
  // Icon name (from .desktop file)
  string icon = 4;
  // Provider that generated this item
  string provider = 5;
  // Relevance score (0.0 - 1.0)
  float score = 6;
  // Additional metadata
  map<string, string> metadata = 7;
  // Resolved icon file path (SVG preferred, then largest PNG)
  string icon_path = 8;
  // Source of the item (e.g., "native", "flatpak", "snap")
  string source = 9;
}

// List available providers
message ListProvidersRequest {}

message ListProvidersResponse {
  repeated ProviderInfo providers = 1;
}

message ProviderInfo {
  // Provider name/identifier
  string name = 1;
  // Human-readable description
  string description = 2;
  // Query prefix (e.g., "=" for calculator)
  string prefix = 3;
  // Whether provider is enabled
  bool enabled = 4;
}
