<?php

namespace App\Classes\Modules\Steps;

use App\Classes\ValueObjects\Constants\OrderSteps;
use App\Http\Resources\Package as PackageResource;
use App\Http\Resources\ShippingArrangement as ShippingArrangementResource;
use App\Http\Resources\DeliveryArrangement as DeliveryArrangementResource;
use App\Models\DeliveryArrangement;
use App\Models\Package;
use App\Models\ShippingArrangement;

class StepAttachments
{
    public function execute($order_id, $referenceId){
        switch ($referenceId) {
            case OrderSteps::ORDER_WAREHOUSE_PACKING_STEP:
                return PackageResource::collection(Package::where('order_id', $order_id)->get());
            case OrderSteps::ORDER_SHIPPING_STEP:
                return new ShippingArrangementResource(ShippingArrangement::where('order_id', $order_id)->first());
            case OrderSteps::ORDER_DELIVERY_STEP:
                return new DeliveryArrangementResource(DeliveryArrangement::where('order_id', $order_id)->first());
            default:
                return null;
        }

    }
}