<?php
require 'vendor/autoload.php';
$app = require_once 'bootstrap/app.php';
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
$kernel->bootstrap();

use App\Models\Product;

$product = Product::first();
$data = $product->toArray();
$data['reseller_price'] = $product->reseller_price;
$data['retail_price'] = $product->effective_price;

echo "=== Product Data (as sent by API) ===\n";
echo "id:             " . ($data['id'] ?? 'NULL') . "\n";
echo "name:           " . ($data['name'] ?? 'NULL') . "\n";
echo "price (DB):     " . ($data['price'] ?? 'NULL') . " (type: " . gettype($data['price']) . ")\n";
echo "sale_price:     " . ($data['sale_price'] ?? 'NULL') . "\n";
echo "cost_price:     " . ($data['cost_price'] ?? 'NULL') . "\n";
echo "reseller_price: " . ($data['reseller_price'] ?? 'NULL') . " (type: " . gettype($data['reseller_price']) . ")\n";
echo "retail_price:   " . ($data['retail_price'] ?? 'NULL') . " (type: " . gettype($data['retail_price']) . ")\n";
echo "effective_price:" . $product->effective_price . "\n";
echo "sku:            " . ($data['sku'] ?? 'NULL') . "\n";
