<?php

namespace App\Modules\Inventory\Stock\Controllers;

use App\Http\Controllers\Controller;
use App\Modules\Inventory\Stock\Models\InventoryStockTransfer;
use App\Support\Operational\InventoryStockTransferOperationalPresenter;
use Illuminate\View\View;

final class InventoryStockTransferPageController extends Controller
{
    public function show(InventoryStockTransfer $transfer): View
    {
        $this->authorize('view', $transfer);
        $transfer->load([
            'sourceWarehouse:id,code,name',
            'destinationWarehouse:id,code,name',
            'item:id,sku,name',
        ]);
        $operational = app(InventoryStockTransferOperationalPresenter::class)->detail($transfer);

        return view('pages.inventory.stock-transfers.show', [
            'transfer' => $transfer,
            ...$operational,
        ]);
    }
}
