<?php

namespace App\Http\Controllers\Orders\Attachments;

use App\Classes\Modules\ControllersLogic\Orders\Attachments\UpdatePackingListLogic;
use App\Classes\ValueObjects\Constants\HttpStatus;
use App\Models\Order;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;

class UpdatePackingListController
{
    /**
     * @param String $orderId
     * @param Request $request
     * @param UpdatePackingListLogic $logic
     * @return JsonResponse
     */
    public function update(String $orderId, Request $request , UpdatePackingListLogic $logic){
        /** @var Order $order */
        $order = Order::findOrFail($orderId);
        $order->packages()->createMany($request->input('packages'));
        return new JsonResponse(null, HttpStatus::RESOURCE_CREATED);

    }

}