<?php

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

use DropshippingExportFreeVendor\WPDesk\Library\DropshippingExport\ConditionalLogic\Fields\Abstraction\WPPostsMetaField;
use DropshippingExportFreeVendor\WPDesk\Library\DropshippingExport\ConditionalLogic\Fields\Abstraction\Field;
use DropshippingExportFreeVendor\WPDesk\Library\DropshippingExport\ConditionalLogic\Fields\Abstraction\AllowedConditions;
use DropshippingExportFreeVendor\WPDesk\Library\DropshippingExport\ConditionalLogic\Conditions\LowerCondition;
use DropshippingExportFreeVendor\WPDesk\Library\DropshippingExport\ConditionalLogic\Conditions\HigherCondition;
use DropshippingExportFreeVendor\WPDesk\Library\DropshippingExport\ConditionalLogic\Conditions\EqualCondition;
use WC_Product;
class StockField implements Field, WPPostsMetaField, AllowedConditions
{
    public static function get_allowed_conditions(): array
    {
        return [LowerCondition::class, HigherCondition::class, EqualCondition::class];
    }
    public static function get_name(): string
    {
        return 'stock';
    }
    public static function get_nice_name(): string
    {
        return __('Product stock', 'dropshipping-export-free');
    }
    public static function get_meta_key(): string
    {
        return '_stock';
    }
    public function get_product_value(WC_Product $product)
    {
        return $product->get_stock_quantity();
    }
}
