syntax = "proto3";

package docparser;

option go_package = "x-agents/proto/docparser";

service DocumentParser {
  rpc ParseDocument(ParseRequest) returns (ParseResponse);
  rpc GetSupportedFormats(Empty) returns (SupportedFormatsResponse);
  rpc GetEngines(Empty) returns (EnginesResponse);
}

message ParseRequest {
  string file_url = 1;
  string file_name = 2;
  string file_type = 3;
  string parser_engine = 4;
  map<string, string> engine_overrides = 5;

  // VLM 配置（可选）
  VLMConfig vlm_config = 6;
}

message VLMConfig {
  bool enabled = 1;              // 是否启用 VLM
  string provider = 2;            // VLM 提供商: openai, anthropic, local 等
  string model = 3;               // 模型名称
  string api_key = 4;             // API Key
  string base_url = 5;            // 自定义 API 地址
  string prompt = 6;              // 自定义提示词
}

message ParseResponse {
  bool success = 1;
  string content = 2;
  string message = 3;
  int32 content_length = 4;
  string file_type = 5;
  string parser_engine = 6;
}

message Empty {}

message SupportedFormatsResponse {
  repeated string file_types = 1;
  map<string, string> file_type_descriptions = 2;
}

message EnginesResponse {
  repeated EngineInfo engines = 1;
}

message EngineInfo {
  string name = 1;
  string description = 2;
  repeated string supported_file_types = 3;
  bool available = 4;
  string unavailable_reason = 5;
}