syntax = "proto3";

package types;

import "composite_payment.proto";
import "composite_frm.proto";

option go_package = "github.com/juspay/connector-service/crates/types-traits/grpc-api-types/proto;proto";

// Service for composite payment operations.
service CompositePaymentService {
  // Runs composite authorize flow.
  rpc Authorize(CompositeAuthorizeRequest) returns (CompositeAuthorizeResponse);

  // Runs composite pre-authenticate flow with access token bootstrapping.
  rpc PreAuthenticate(CompositePreAuthenticateRequest) returns (CompositePreAuthenticateResponse);

  // Runs composite get flow.
  rpc Get(CompositeGetRequest) returns (CompositeGetResponse);

  // Runs composite refund flow.
  rpc Refund(CompositeRefundRequest) returns (CompositeRefundResponse);

  // Runs composite void flow.
  rpc Void(CompositeVoidRequest) returns (CompositeVoidResponse);

  // Runs composite capture flow.
  rpc Capture(CompositeCaptureRequest) returns (CompositeCaptureResponse);

  // Runs composite verify redirect response flow (verify + conditional authorize).
  rpc VerifyRedirectResponse(CompositeVerifyRedirectResponseRequest) returns (CompositeVerifyRedirectResponseResponse);
}

service CompositeRefundService {
  // Runs composite refund get/sync flow.
  rpc Get(CompositeRefundGetRequest) returns (CompositeRefundGetResponse);
}

// Single-call webhook processing for callers that have secrets resolved upfront.
// Use EventService (ParseEvent → HandleEvent) when secrets must be looked up first.
service CompositeEventService {
  rpc HandleEvent(CompositeEventHandleRequest) returns (CompositeEventHandleResponse);

  // FRM notify connector flow with access token bootstrapping.
  // Delegates to EventService.NotifyConnector for actual event handling.
  rpc Notify(CompositeNotifyRequest) returns (CompositeNotifyResponse);
}


// Service for composite payment method operations.
service CompositePaymentMethodService {
  // Runs composite payment method create flow.
  rpc Create(CompositePaymentMethodCreateRequest) returns (CompositePaymentMethodCreateResponse);
  
  // Runs composite payment method get flow.
  rpc Get(CompositePaymentMethodGetRequest) returns (CompositePaymentMethodGetResponse);
  
  // Runs composite payment method recharge flow.
  rpc Recharge(CompositePaymentMethodRechargeRequest) returns (CompositePaymentMethodRechargeResponse);
}

// Service for composite fraud and risk management operations.
service CompositeFraudAndRiskManagementService {
  // Runs composite pre-risk check flow with access token bootstrapping.
  rpc PreRiskCheck(CompositeFrmPreRiskCheckRequest) returns (CompositeFrmPreRiskCheckResponse);

  // Runs composite post-risk check flow with access token bootstrapping.
  rpc PostRiskCheck(CompositeFrmPostRiskCheckRequest) returns (CompositeFrmPostRiskCheckResponse);
}
