<?php

namespace KupShop\AutomationConfiguratorBundle\Configurator\Orders\Conditions\Fields;

use KupShop\AutomationConfiguratorBundle\Configurator\Interfaces\Conditions\Fields\Field;
use KupShop\AutomationConfiguratorBundle\Configurator\Orders\OrdersContext;
use KupShop\AutomationConfiguratorBundle\Util\ExpressionContext;

class TimeOrderCreated extends Field implements OrdersContext
{
    public function getConfig(): array
    {
        return [
            'label' => 'Čas vytvoření objednávky (!)',
            'type' => 'time',
            'function' => true,
        ];
    }

    public function getName(): string
    {
        return 'time_order_created';
    }

    public function getGroupName(): ?string
    {
        return 'time';
    }

    public function modifyPrefetchFastCondition($context, $jsonValue)
    {
        //        $context->andWhere("CAST(date_created AS time) > SEC_TO_TIME(:time))");

        return $context;
    }

    public function getCompareValue(ExpressionContext $context, $args = null)
    {
        return true;
    }

    public function isEnabled(): bool
    {
        return false;
    }
}
