<?php

declare(strict_types=1);

namespace apexl\Io\modules\payment\Dto;

/**
 * Output from {@see \apexl\Io\modules\payment\Contract\HostedCheckoutInterface::createCheckoutSession()}.
 *
 * The consumer stores `$gatewaySessionRef` on its local checkout-session
 * row + redirects the shopper to `$hostedUrl`. After completion the
 * gateway redirects to `success_url` / `cancel_url` AND fires a webhook;
 * the consumer reconciles via either path.
 */
final readonly class CheckoutSessionResult
{
    public function __construct(
        public string $gatewaySessionRef,
        public string $hostedUrl,
        public string $status,
        public ?int   $expiresAt = null,
        public ?string $gatewayPaymentRef = null,
        public ?string $gatewaySubscriptionRef = null,
        public ?string $gatewayCustomerRef = null,
    ) {}

    public const string STATUS_OPEN      = 'open';
    public const string STATUS_COMPLETE  = 'complete';
    public const string STATUS_EXPIRED   = 'expired';
    public const string STATUS_CANCELLED = 'cancelled';
}
