<?php

namespace App\Http\Controllers\v1\Tenancy\Product;

use App\Http\Controllers\Controller;
use App\Http\Requests\UpdateOrderDeliveryRequest;
use App\Models\Tenancy\Order;
use Illuminate\Http\Response;

class UpdateOrderDeliveryController extends Controller
{
    public function __invoke(string $deliveryId, UpdateOrderDeliveryRequest $request): Response
    {
        $order = Order::ofDelivery($deliveryId)->firstOrFail();
        $order->delivery_status = $request->delivery_status;
        $order->save();

        return $this->ok($order);
    }
}
