<?php
declare(strict_types=1);

namespace App\Modules\Sales\Services;

use App\Modules\Payments\Services\PaymentService;

/**
 * Guest payment wrapper — delegates to PaymentService with member_id = null.
 * Kept as a thin adapter so callers don't need to change.
 */
final class InventoryPaymentService
{
    /**
     * Process a guest payment (no member_id required).
     * Delegates entirely to the central PaymentService.
     */
    public static function processGuestPayment(array $data): array
    {
        return PaymentService::processPayment([
            'member_id'           => null,
            'amount'              => $data['amount'] ?? '0.00',
            'payment_type'        => $data['payment_type'] ?? 'inventory_sale',
            'payment_method'      => $data['payment_method'] ?? 'cash',
            'guest_name'          => $data['guest_name'] ?? 'زائر',
            'related_entity_type' => $data['related_entity_type'] ?? null,
            'related_entity_id'   => $data['related_entity_id'] ?? null,
            'description'         => $data['description'] ?? 'مبيعات مخزون (زائر)',
        ]);
    }
}
