<?php
/* phpcs:disable WordPress
 * phpcs:disable Generic.Arrays.DisallowShortArraySyntax */
namespace WeeConnectPay\Api;

class ApiEndpoints {

	/**
	 * Find or create a WooCommerce integration and return its UUID
	 * @return string
	 */
	public static function woocommerceIntegration(): string {
		return 'integration/woocommerce';
	}

	/**
	 * Verify that an integration is authenticated and belongs to the currently authenticated entity
	 * @param string $integrationUuid
	 *
	 * @return string
	 */
	public static function verifyIntegrationAuthentication ( string $integrationUuid ): string {
		return "/v1/integrations/$integrationUuid/verify";
	}

	/**
	 * Read the backend's authoritative health verdict for the integration resolved
	 * from the bearer context (no uuid in the path — mirrors get-caller-identity).
	 * Returns the contract health shape: { status, scenario, reason_code, authoritative, transient }.
	 *
	 * @return string
	 * @since 4.2.0
	 */
	public static function integrationStatus(): string {
		return '/v1/integration/status';
	}

	/**
	 * Endpoint to create a charge on a Clover order using a tokenized card
	 * @param string $cloverOrderUuid
	 *
	 * @return string
	 * @since 2.0
	 */
	public static function createOrderCharge(string $cloverOrderUuid): string {
		return "/v1/clover/orders/$cloverOrderUuid/charge";
	}

	/**
	 * Endpoint to create a preauthorization charge.
	 *
	 * @return string
	 * @since 3.16
	 */
	public static function createCharge(): string {
		return "/v1/clover/charges";
	}

	/**
	 * Endpoint to finalize a 3-D Secure charge after the browser completes the
	 * method or challenge flow. Body: { charge_id, flow_status, order_uuid?,
	 * saved_credential?, save_credential? }.
	 *
	 * @return string
	 * @since 4.2.0
	 */
	public static function finalizeThreeDSCharge(): string {
		return "/v1/clover/charges/3ds/finalize";
	}

    /**
     * Endpoint to create a charge on a Clover order using a Custom Tender like a gift card
     * @param string $cloverOrderUuid
     *
     * @return string
     * @since 3.12.2
     */
    public static function createOrderCustomTenderCharge(string $cloverOrderUuid): string {
        return "/v1/clover/orders/$cloverOrderUuid/custom-tender/charge";
    }

    /**
     * Endpoint to refund a charge
     * @param string $cloverChargeUuid
     *
     * @return string
     * @since 3.12.4
     */
    public static function refundCharge(string $cloverChargeUuid): string {
        return "/v1/clover/charges/$cloverChargeUuid/refund";
    }

    /**
     * Endpoint to capture a pre-authorized charge
     * @param string $cloverChargeUuid
     *
     * @return string
     * @since 3.17.0
     */
    public static function captureCharge(string $cloverChargeUuid): string {
        return "/v1/clover/charges/$cloverChargeUuid/capture";
    }

	/**
	 * Endpoint to create a customer without having to tokenize a card first
	 *
	 * @return string
	 * @since 2.4.0
	 */
	public static function createCustomer(): string {
		return "/v1/clover/customers";
	}

	/**
	 * Endpoint to update a payment method
	 * @param string $tokenizedCardUuid
	 *
	 * @return string
	 * @since 3.14.0
	 */
	public static function updatePaymentMethod( ?string $tokenizedCardUuid ): string {
		return "/v1/clover/saved-credentials/$tokenizedCardUuid";
	}
}
