syntax = "proto3";

// Payment gRPC — Backend Architecture §15, §21, §26 (Phase 2/3).
// CAP (or any future business service) calls this server-to-server —
// the client never talks to Orchestrator's payment surface directly.
// Orchestrator never receives or computes a price; it only processes
// (amount, reference) pairs (§15). Reusable for LMS/Workmaster later
// without changing this contract.
//
// amount_minor_units is int64 (kobo / minor units), never float/double.
// Generated TS must use bigint (buf.gen.yaml forceLong=bigint) to match
// @elimi/common Money. Do not add RPCs without updating §21 first.
package orchestrator.v1;

option go_package = "github.com/C-STEMP/elimi-ecosystem/proto/orchestrator/v1;orchestratorv1";

service PaymentService {
  rpc InitiatePayment(InitiatePaymentRequest) returns (InitiatePaymentResponse);
}

message InitiatePaymentRequest {
  int64 amount_minor_units = 1;   // kobo — never a float, §21. See @elimi/common Money.
  string currency = 2;            // ISO 4217, e.g. "NGN"
  string reference_type = 3;      // "cap_application" | "lms_enrollment" | ... — opaque to Orchestrator
  string reference_id = 4;
  string user_id = 5;
  string purpose = 6;             // e.g. "rpl_assessment_fee" — display/audit only
  map<string, string> metadata = 7;
}

message InitiatePaymentResponse {
  string payment_id = 1;
  string checkout_url = 2;        // client redirect; result via payment.completed event (§20)
}
