syntax = "proto3";
package angzarr;
option go_package = "github.com/angzarr/angzarr/proto/angzarr";
option java_package = "dev.angzarr";
option java_multiple_files = true;
option csharp_namespace = "Angzarr";
option ruby_package = "Angzarr";

import "angzarr/types.proto";

// SagaService: client logic that coordinates across aggregates
// Two-phase protocol: Prepare (declare destinations) → Execute (with fetched state)
service SagaService {
  // Self-description: component type, subscribed domains, handled event types
  rpc GetDescriptor (GetDescriptorRequest) returns (ComponentDescriptor);
  // Phase 1: Saga declares which destination aggregates it needs
  rpc Prepare (SagaPrepareRequest) returns (SagaPrepareResponse);
  // Phase 2: Execute with source + fetched destination state
  rpc Execute (SagaExecuteRequest) returns (SagaResponse);
}

// SagaCoordinatorService: orchestrates saga execution across domains
service SagaCoordinatorService {
  // Speculative execution - returns commands without executing them
  rpc ExecuteSpeculative (SagaExecuteRequest) returns (SagaResponse);
}
