<?php

declare(strict_types=1);

namespace App\Services\Payment;

use App\Models\Payment;

interface PaymentGatewayInterface
{
    /**
     * Returns ['status' => string, 'pg_tid' => string|null, 'raw' => array]
     */
    public function authorize(Payment $payment, array $context = []): array;

    public function capture(Payment $payment, ?int $amount = null): array;

    public function refund(Payment $payment, int $amount, ?string $reason = null): array;

    /**
     * Returns latest status from PG.
     */
    public function getStatus(Payment $payment): array;

    /**
     * Verify webhook signature; throws on failure.
     */
    public function verifyWebhook(string $payload, ?string $signature = null, array $headers = []): bool;

    public function provider(): string;

    public function isMock(): bool;
}
