<?php

declare(strict_types=1);

namespace KupShop\GraphQLBundle\ApiAdmin\Controller;

use KupShop\GraphQLBundle\ApiAdmin\Types\Purchase\Input\PurchaseCalculateInput;
use KupShop\GraphQLBundle\ApiAdmin\Types\Purchase\PurchaseState;
use KupShop\GraphQLBundle\ApiAdmin\Util\PurchaseUtil;
use TheCodingMachine\GraphQLite\Annotations\Query;

class PurchaseController
{
    public function __construct(
        private PurchaseUtil $purchaseUtil,
    ) {
    }

    /**
     * Vrátí informace o nákupu - ceny položek, slevy, výslednou cenu...
     */
    #[Query]
    public function purchaseCalculate(PurchaseCalculateInput $input): ?PurchaseState
    {
        return $this->purchaseUtil->calculatePurchaseState($input);
    }
}
