<?php

namespace App\Model\Entities\Components;

use App\Model\Entities\BaseEntity;
use App\Model\Entities\Security\User;
use DateTime;
use Doctrine\ORM\Mapping as ORM;


/**
 * @ORM\Entity
 * @ORM\Table(name="review")
 * @ORM\InheritanceType(value="SINGLE_TABLE")
 * @ORM\DiscriminatorColumn(name="type")
 */
abstract class Review extends BaseEntity
{
    /**
     * @var User
     * @ORM\ManyToOne(targetEntity="App\Model\Entities\Security\User")
     *
     */
    protected $grantedBy;

    /**
     * @var DateTime
     * @ORM\Column(type="datetime")
     */
    protected $grantedAt;

    /**
     * @ORM\Column(type="integer")
     */
    protected $value;

    /**
     * ArticleReview constructor.
     * @param User $grantedBy
     * @param $value
     */
    public function __construct(User $grantedBy, $value)
    {
        $this->grantedBy = $grantedBy;
        $this->value = $value;
        $this->grantedAt = new DateTime();
    }

    /**
     * @return User
     */
    public function getGrantedBy()
    {
        return $this->grantedBy;
    }

    /**
     * @return DateTime
     */
    public function getGrantedAt()
    {
        return $this->grantedAt;
    }

    /**
     * @return mixed
     */
    public function getValue()
    {
        return $this->value;
    }
}