/**
 * PaymentServiceInterface
 * Base interface/contract for all payment service implementations
 * All payment services must implement these methods
 */

class PaymentServiceInterface {
  /**
   * Initialize a payment
   * @param {number} amount - Payment amount
   * @param {string} reference - Unique payment reference
   * @param {object} metadata - Additional payment data (user_id, email, phone, etc.)
   * @returns {Promise<{success: boolean, data: object, message: string}>}
   */
  async initializePayment(amount, reference, metadata = {}) {
    throw new Error('initializePayment() must be implemented');
  }

  /**
   * Verify a payment status
   * @param {string} reference - Payment reference to verify
   * @returns {Promise<{success: boolean, data: object, message: string}>}
   */
  async verifyPayment(reference) {
    throw new Error('verifyPayment() must be implemented');
  }

  /**
   * Get payment status
   * @param {string} reference - Payment reference
   * @returns {Promise<string>} - 'pending', 'processing', 'completed', 'failed'
   */
  async getPaymentStatus(reference) {
    throw new Error('getPaymentStatus() must be implemented');
  }

  /**
   * Handle webhook notification from payment provider
   * @param {object} payload - Webhook payload
   * @param {object} headers - Request headers (for signature verification)
   * @returns {Promise<{success: boolean, data: object}>}
   */
  async handleWebhook(payload, headers = {}) {
    throw new Error('handleWebhook() must be implemented');
  }

  /**
   * Verify webhook signature
   * @param {string} payload - Raw webhook payload
   * @param {string} signature - Signature from headers
   * @returns {boolean}
   */
  verifyWebhookSignature(payload, signature) {
    throw new Error('verifyWebhookSignature() must be implemented');
  }

  /**
   * Get payment method configuration
   * @returns {object}
   */
  getConfig() {
    return {
      name: this.constructor.name,
      type: 'unknown',
      isAutomated: false,
      requiresProof: false
    };
  }
}

module.exports = PaymentServiceInterface;
