<?php


namespace App\Model\Entities;


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

/**
 * @Doctrine\ORM\Mapping\Entity
 * @Doctrine\ORM\Mapping\Table(name="dkp")
 */
class Dkp extends BaseEntity
{
    /**
     * @ORM\Column(type="string")
     */
    protected $reason;

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

    /**
     * @var ISite
     * @ORM\ManyToOne(targetEntity="MmorpgGuild")
     */
    protected $site;

    /**
     * @var User
     * @ORM\ManyToOne(targetEntity="App\Model\Entities\Security\User")
     */
    protected $player;

    /**
     * @var User
     * @ORM\ManyToOne(targetEntity="App\Model\Entities\Security\User")
     */
    protected $grantedBy;

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

    public function __construct(User $grantedBy)
    {
        $this->grantedBy = $grantedBy;
        $this->grantedAt = new DateTime();
    }

    /**
     * @return string
     */
    public function getReason() : string
    {
        return $this->reason;
    }

    /**
     * @param string $reason
     */
    public function setReason(string $reason)
    {
        $this->reason = $reason;
    }

    /**
     * @return int
     */
    public function getAmount() : int
    {
        return $this->amount;
    }

    /**
     * @param int $amount
     */
    public function setAmount($amount)
    {
        $this->amount = $amount;
    }

    /**
     * @return ISite
     */
    public function getSite() : ISite
    {
        return $this->site;
    }

    /**
     * @param ISite $site
     */
    public function setSite(ISite $site)
    {
        $this->site = $site;
    }

    /**
     * @return User
     */
    public function getPlayer() : User
    {
        return $this->player;
    }

    /**
     * @param User $player
     */
    public function setPlayer(User $player)
    {
        $this->player = $player;
    }

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

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