<?php

declare(strict_types=1);

namespace portalpeople\orders\services;

use frontend\models\Cart;

/**
 * OrderService
 *
 * Handles order creation from API requests.
 * Extracted from api/modules/v1/controllers/OrderController::actionNew().
 */
class OrderService
{
    /**
     * Create a new order from API post data.
     *
     * @param array<string, mixed> $params  Request body params
     * @return Cart
     */
    public function createFromApi(array $params): Cart
    {
        return Cart::fromApi($params);
    }
}
