syntax = "proto3";

package worldmonitor.intelligence.v1;

import "buf/validate/validate.proto";
import "sebuf/http/annotations.proto";

// GetCountryIntelBriefRequest specifies which country to generate a brief for.
message GetCountryIntelBriefRequest {
  // ISO 3166-1 alpha-2 country code.
  string country_code = 1 [
    (buf.validate.field).required = true,
    (buf.validate.field).string.len = 2,
    (buf.validate.field).string.pattern = "^[A-Z]{2}$",
    (sebuf.http.query) = {name: "country_code"}
  ];
  // Optional analytical framework instructions to append to system prompt. Max 2000 chars enforced at handler level.
  string framework = 2 [(sebuf.http.query) = {name: "framework"}];
}

// BriefSource describes one article used to ground an AI-generated brief.
message BriefSource {
  // Source article headline.
  string title = 1;
  // Source outlet or feed label.
  string source = 2;
  // Absolute http(s) source article URL.
  string url = 3;
  // Article publication time, when available.
  string published_at = 4;
}

// GetCountryIntelBriefResponse contains an AI-generated intelligence brief for a country.
message GetCountryIntelBriefResponse {
  // ISO 3166-1 alpha-2 country code.
  string country_code = 1;
  // Country name.
  string country_name = 2;
  // AI-generated intelligence brief text.
  string brief = 3;
  // AI model used for generation.
  string model = 4;
  // Brief generation time, as Unix epoch milliseconds.
  int64 generated_at = 5 [(sebuf.http.int64_encoding) = INT64_ENCODING_NUMBER];
  // Source articles used to ground the generated brief.
  repeated BriefSource sources = 6;
}
