<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use App\Http\Requests\CreateDepositoRequest;
use App\Http\Requests\UpdateDepositoRequest;
use App\Services\DepositoService;

class DepositoController extends Controller
{
    protected $depositoService;

    public function __construct(DepositoService $depositoService)
    {
        $this->depositoService = $depositoService;
    }

    public function index()
    {
        return $this->depositoService->getAll();
    }

    public function create()
    {
        //
    }

    public function store(CreateDepositoRequest $request)
    {
        $validated = $request->validated();
        return $this->depositoService->createDeposito($validated);
    }

    public function show(string $id)
    {
        return $this->depositoService->findById($id);
    }

    public function edit(string $id)
    {
        //
    }

    public function update(UpdateDepositoRequest $request, string $id)
    {
        $validated = $request->validated();

        return $this->depositoService->updateDeposito($id, $validated);
    }

    public function destroy(string $id)
    {
        return $this->depositoService->deleteDeposito($id);
    }
}
