<?php

namespace CouponsPlus\App\Coupon;

use CouponsPlus\App\Coupon\Tree\Abilities;
use CouponsPlus\Original\Characters\StringManager;
use CouponsPlus\Original\Collections\MappedObject;
use JsonSerializable;

class CardData implements Abilities\CardData, JsonSerializable
{
    protected string $id;
    /** @property StringManager */
    private $type;
    private $options;

    public function __construct(string $type, MappedObject $options, string $id = null)
    {
        $this->type = new StringManager($type);
        $this->options = $options;
        $this->id = $id ?? uniqid(wp_rand(), true);
    }
    public function getID(): string
    {
        return $this->id;
    }

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

    public function getOptions(): MappedObject
    {
        return $this->options;
    }

    #[\ReturnTypeWillChange]
    public function jsonSerialize() : array
    {
        return get_object_vars($this);
    } 
}