<?php

namespace CouponsPlus\App\Coupon\Attributes;

use CouponsPlus\Original\Characters\StringManager;
use CouponsPlus\App\Coupon\Attributes\Abilities\AttributeData;
use CouponsPlus\App\Coupon\Attributes\Abilities\MatchableAttribute;

class AttributeToMatch implements MatchableAttribute
{
    /**
     * @var AttributeData
     */
    protected $data;
    /**
     * @var string
     */
    protected $type;

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

    public function getData(): AttributeData
    {
        return $this->data;
    }

    public function shouldMatchAnyValue(): bool
    {
        return $this->getType()->is('any');
    }

    public function getType(): StringManager
    {
        return new StringManager($this->type);
    }
}