<?php

namespace App\Modules\Sales\Services;

use App\Modules\Sales\Models\SalesOrder;
use App\Modules\Sales\Models\SalesOrderLine;

final class SalesOutboundEventContext
{
    /** @return array<string, mixed> */
    public static function orderLine(
        int $tenantId,
        SalesOrder $order,
        SalesOrderLine $line,
        ?string $correlationId,
    ): array {
        return [
            'tenant_id' => $tenantId,
            'correlation_id' => $correlationId ?? (string) $order->correlation_id,
            'sales_order_id' => (int) $order->id,
            'sales_order_line_id' => (int) $line->id,
            'reservation_public_id' => (string) $line->reservation_public_id,
            'reference_type' => 'sales_order',
            'reference_id' => (int) $order->id,
        ];
    }
}
