<?php

namespace App\Classes\Modules\Steps;

use App\Classes\ValueObjects\Constants\OrderSteps;

class GetStep
{
    public function execute($referenceId){
        if(array_key_exists($referenceId, OrderSteps::ORDER_PRIMARY_STEPS)){
            return OrderSteps::ORDER_PRIMARY_STEPS[$referenceId];
        }

        if(array_key_exists($referenceId, OrderSteps::ORDER_PRIMARY_MODULAR_STEPS)){
            return OrderSteps::ORDER_PRIMARY_MODULAR_STEPS[$referenceId];
        }

        foreach(OrderSteps::ORDER_MODULAR_STEPS as $module){
            foreach($module as $group){
                if(array_key_exists($referenceId, $group['steps'])){
                    return $group['steps'][$referenceId];
                }
            }
        }

    }
}