<?php

namespace App\Exceptions;

use RuntimeException;
use Throwable;

class PaymentGatewayException extends RuntimeException
{
    public const CODE_CAPTURE_ALREADY_CAPTURED = 'capture_already_captured';
    public const CODE_CAPTURE_TRANSIENT = 'capture_transient_failure';
    public const CODE_CAPTURE_FAILED = 'capture_failed';
    public const CODE_PAYMENT_FETCH_FAILED = 'payment_fetch_failed';

    public function __construct(
        string $message,
        private readonly string $reasonCode,
        int $code = 0,
        ?Throwable $previous = null
    ) {
        parent::__construct($message, $code, $previous);
    }

    public function reasonCode(): string
    {
        return $this->reasonCode;
    }
}
