syntax = "proto3";

package billing.documents.v1;

option go_package = "github.com/tech/sendico/pkg/proto/billing/documents/v1;documentsv1";


// ---------------------------
// SERVICE
// ---------------------------

// DocumentService provides operation-level document generation.
service DocumentService {
  // GetOperationDocument returns a generated PDF file for
  // a gateway operation snapshot provided by the caller.
  rpc GetOperationDocument(GetOperationDocumentRequest)
      returns (GetDocumentResponse);
}

// GetDocumentResponse returns the generated PDF content.
message GetDocumentResponse {
  // Raw PDF bytes
  bytes  content   = 1;

  // Suggested filename for download (e.g. invoice_123.pdf)
  string filename  = 2;

  // MIME type, typically "application/pdf"
  string mime_type = 3;
}

// GetOperationDocumentRequest requests a document for a
// single gateway operation.
message GetOperationDocumentRequest {
  string organization_ref = 1;
  string gateway_service = 2;
  string operation_ref = 3;

  string payment_ref = 4;
  string operation_code = 5;
  string operation_label = 6;
  string operation_state = 7;
  string failure_code = 8;
  string failure_reason = 9;

  string amount = 10;
  string currency = 11;

  int64 started_at_unix_ms = 12;
  int64 completed_at_unix_ms = 13;
  string client_name = 14;
  string client_address = 15;
}
