<?php

namespace App\Classes\Modules\Orders\Processors;


use App\Classes\Modules\ControllerLogic\Exceptions\InternalServerErrorException;
use App\Classes\Modules\Orders\DataTransferObjects\StepObject;
use App\Classes\ValueObjects\Constants\OrderSteps;
use Illuminate\Http\JsonResponse;

class WarehouseUnpackingOrder extends AbstractStepProcessor
{

    /** @var string  */
    const STEP_REFERENCE = OrderSteps::ORDER_WAREHOUSE_UNPACKING_STEP;

    /** @var int */
    private $orderId;

    /** @var StepObject */
    private $step;

    /**
     * WarehousePackOrder constructor.
     * @param int $orderId
     * @param string $completeDate
     */
    public function __construct(int $orderId, string $completeDate = null)
    {
        $this->orderId = $orderId;
        $this->step = new StepObject(self::STEP_REFERENCE, $completeDate);

    }

    /**
     * @return bool
     */
    public function validator(): bool {
        return true;
    }


    /**
     * @return JsonResponse
     * @throws InternalServerErrorException
     */
    public function execute(): JsonResponse {
        return $this->handler($this->orderId, $this->step);
    }

}