<?php

namespace App\Http\Controllers;

use App\Services\StockService;
use Illuminate\Http\Request;

class StockController extends Controller
{
    public function __construct(protected StockService $stockService)
    {
    }

    public function index(Request $request)
    {
        $stocks = $this->stockService->getStockList($request);
        $summary = $this->stockService->getStockSummary();

        return view('stock.index', compact('stocks', 'summary'));
    }

    public function ledger(Request $request)
    {
        $entries = $this->stockService->getStockLedger($request);

        return view('stock.ledger', compact('entries'));
    }
}
