<?php

namespace DropshippingExportFreeVendor\WPDesk\Library\DropshippingExport\ProductFields\Value;

use DropshippingExportFreeVendor\WPDesk\Library\DropshippingExport\ProductFields\ProductFieldStringValue;
use DropshippingExportFreeVendor\WPDesk\Library\DropshippingExport\ProductFields\ProductFieldValue;
use DropshippingExportFreeVendor\WPDesk\Library\DropshippingExport\ProductFields\ProductFieldCustomStringValue;
use WC_Product;
class CustomTextProductFieldValue implements ProductFieldValue, ProductFieldStringValue, ProductFieldCustomStringValue
{
    public const KEY = 'custom_txt';
    private ?string $value = null;
    private WC_Product $product;
    public function __construct(WC_Product $product)
    {
        $this->product = $product;
    }
    public function set_string_value(string $value): void
    {
        $this->value = $value;
    }
    public static function get_key(): string
    {
        return self::KEY;
    }
    public static function get_name(): string
    {
        return esc_attr__('Custom text', 'dropshipping-export-free');
    }
    public function has_string_value(): bool
    {
        return \is_string($this->get_field_value());
    }
    public function get_string_value(): ?string
    {
        return $this->get_field_value();
    }
    private function get_field_value(): ?string
    {
        if ($this->value !== null) {
            return $this->value;
        }
        return $this->value;
    }
}
