<?php

namespace DropshippingExportFreeVendor\WPDesk\Library\DropshippingExport\ConditionalLogic\Conditions;

use DropshippingExportFreeVendor\WPDesk\Library\DropshippingExport\ConditionalLogic\Conditions\Abstraction\Condition;
use DropshippingExportFreeVendor\WPDesk\Library\DropshippingExport\ConditionalLogic\Conditions\Abstraction\ConditionOperator;
use DropshippingExportFreeVendor\WPDesk\Library\DropshippingExport\ConditionalLogic\Conditions\Abstraction\ConditionWithValue;
class NotContainsCondition implements Condition, ConditionWithValue, ConditionOperator
{
    public const SEPARATOR = '|';
    private string $value = '';
    public function is_valid($field_value): bool
    {
        foreach ($this->get_values() as $value) {
            if (is_string($field_value) && \is_string($value)) {
                $result = strpos(mb_strtolower($field_value), mb_strtolower($value)) === \false;
                if ($result) {
                    return $result;
                }
            }
        }
        return \false;
    }
    public static function get_operator(): string
    {
        return 'NOT LIKE';
    }
    public static function get_operator_value($value): string
    {
        return $value;
    }
    public static function get_name(): string
    {
        return 'not_contains';
    }
    public static function get_nice_name(): string
    {
        return __('Not contains', 'dropshipping-export-free');
    }
    public function set_value(string $value)
    {
        $this->value = $value;
    }
    public function get_values(): array
    {
        return \explode(self::SEPARATOR, $this->value);
    }
    public function has_multiple_values(): bool
    {
        return count($this->get_values()) > 1;
    }
}
