<?php

namespace App\Classes\Modules\ControllersLogic\Orders;


use App\Classes\Modules\Orders\Services\SearchesOrder;
use App\Classes\Modules\Companies\Services\FetchCompanyOrderCategorySteps;
use Illuminate\Http\Request;

class SearchOrderLogic
{
    /** @var FetchCompanyOrderCategorySteps  */
    private $fetchCompanyOrderCategorySteps;

    /** @var  SearchesOrder */
    private $searchesOrder;

    /**
     * SearchOrderLogic constructor.
     * @param FetchCompanyOrderCategorySteps $fetchCompanyOrderCategorySteps
     * @param SearchesOrder $searchesOrder
     */
    public function __construct(FetchCompanyOrderCategorySteps $fetchCompanyOrderCategorySteps, SearchesOrder $searchesOrder)
    {
        $this->fetchCompanyOrderCategorySteps = $fetchCompanyOrderCategorySteps;
        $this->searchesOrder = $searchesOrder;
    }


    public function execute(Request $request)
    {
        return $this->searchesOrder->execute($request, $request->input('status') ? $this->fetchCompanyOrderCategorySteps->execute($request->input('status')) : []);
    }
}