<?php

namespace App\Classes\Modules\Steps\ControllersLogic;

use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\Orders\DataTransferObjects\OrderObject;
use App\Classes\Modules\Orders\Services\CreatesOrder;
use App\Classes\Modules\Orders\Standards\Rules\CanCreateOrder;
use App\Classes\ValueObjects\Constants\OrderStatus;
use App\Classes\ValueObjects\Constants\Steps;
use App\Classes\ValueObjects\Constants\OrderType;
use App\Http\Resources\StepResource;
use App\Classes\Modules\Steps\DataTransferObjects\StepsObject;
use App\Classes\Modules\Steps\Services\FetchesSteps;
use App\Classes\Modules\Steps\Processors\CompletesStepProcessor;


use Illuminate\Http\Request;
use Illuminate\Http\JsonResponse;

class CompletesStepLogic extends AbstractControllerLogic
{

    private $completeStepProcessor;

    public function __construct(CompletesStepProcessor $completeStepProcessor)
    {
        $this->completeStepProcessor = $completeStepProcessor;
    }

    protected function notification():array {
        return [
            'title' => 'Completed Order Step',
            'message' => 'You have successfully completed a order step'
        ];
    }

    public function logic(Request $request) : JsonResponse {

        $completedStep = $this->completeStepProcessor->execute($request);

        return $this->resourceResponse(new StepResource($completedStep));
    }
}
