syntax = "proto3";

package payments.endpoint.v1;

option go_package = "github.com/tech/sendico/pkg/proto/payments/endpoint/v1;endpointv1";

import "api/proto/common/describable/v1/describable.proto";
import "api/proto/common/permission_bound/v1/pbound.proto";

// PaymentMethodType classifies the kind of payment instrument.
enum PaymentMethodType {
  PAYMENT_METHOD_TYPE_UNSPECIFIED = 0;
  PAYMENT_METHOD_TYPE_IBAN = 1;
  PAYMENT_METHOD_TYPE_CARD = 2;
  PAYMENT_METHOD_TYPE_CARD_TOKEN = 3;
  PAYMENT_METHOD_TYPE_BANK_ACCOUNT = 4;
  PAYMENT_METHOD_TYPE_WALLET = 5;
  PAYMENT_METHOD_TYPE_CRYPTO_ADDRESS = 6;
  PAYMENT_METHOD_TYPE_LEDGER = 7;
  PAYMENT_METHOD_TYPE_ACCOUNT = 8;
}

// PaymentMethod represents a stored payment instrument (card, IBAN, wallet, etc.).
message PaymentMethod {
  common.describable.v1.Describable describable = 1;
  string recipient_ref = 2;
  PaymentMethodType type = 3;
  bytes data = 4;
  bool is_main = 5;
}

// PaymentEndpoint resolves a payment destination by reference, inline method,
// or payee lookup.
message PaymentEndpoint {
  oneof source {
    string payment_method_ref = 1;
    PaymentMethod payment_method = 2;
    string payee_ref = 3;
  }
}

// PaymentMethodRecord wraps a PaymentMethod with its permission and
// persistence metadata.
message PaymentMethodRecord {
  common.pbound.v1.PermissionBound permission_bound = 1;
  PaymentMethod payment_method = 2;
}
