<?php

namespace CouponsPlus\App\Coupon\Attributes\Data;

use WP_Term;
use CouponsPlus\Original\Characters\StringManager;
use CouponsPlus\app\coupon\attributes\abilities\AttributeData;
use CouponsPlus\app\coupon\attributes\abilities\AttributeValueData;

/**
 * This one represents an attribute value created from inside a product. It's a local attribute, not a global one
 * and as such it doesn't have an id or a name. Literally its only value is the key.
 *
 *
 * For example: 'blue'. That's it, that's all the info we have for this kind of attribute value.
 */
class LocalAttributeValueData implements AttributeValueData
{
    /**
     * @var string
     */
    protected $slug;
    /**
     * @var AttributeData
     */
    protected $attributeData;

    public function __construct(string $slug, AttributeData $attributeData)
    {
        $this->slug = $slug;
        $this->attributeData = $attributeData;
    }

    public function getId(): StringManager
    {
        return new StringManager($this->slug);
    }

    public function getKey(): StringManager
    {
        return $this->getId();
    }

    public function getValue(): StringManager
    {
        return $this->getId();
    }

    public function getAttribute(): AttributeData
    {
        return $this->attributeData;
    }
}