<?php


namespace App\Classes\Modules\Transactions\ControllersLogic;

use App\Models\Bank;
use Illuminate\Http\Request;
use Illuminate\Http\JsonResponse;
use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\Transactions\Services\GeneratesBankBalanceAccount;

class FetchBankAccountBalanceLogic extends AbstractControllerLogic
{
    /**
     * @return array
     */
    protected function notification():array {
        return [
            'title' => 'Retrieved Bank Balance Account',
            'message' => 'You have successfully retrieved bank balance account'
        ];
    }

    /** @var GeneratesBankBalanceAccount */
    private $generatesBankBalanceAccount;

    /**
     * FetchCompanyAccountBalanceLogic constructor.
     * @param GeneratesBankBalanceAccount $generatesBankBalanceAccount
     */
    public function __construct(GeneratesBankBalanceAccount $generatesBankBalanceAccount)
    {
        $this->generatesBankBalanceAccount = $generatesBankBalanceAccount;
    }

    public function logic(Request $request) : JsonResponse
    {
        $bank = Bank::find($request->route('id'));

        return $this->response(['data' => $this->generatesBankBalanceAccount->execute($bank)]);

    }



}
