<?php

namespace App\Model\Entities\GameData\Mmorpg;

use App\Model\Entities\BaseNamedRecord;
use App\Model\Entities\Game;
use App\Model\Interfaces\ICommonRecord;
use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity
 * @ORM\Table(name="instance_type")
 */
class InstanceType extends BaseNamedRecord implements ICommonRecord
{
    const PVE = true;
    const PVP = false;

    /**
     * @ORM\Column(type="boolean", name="is_pve")
     */
    protected $isPvE;

    /**
     * @var Game
     * @ORM\ManyToOne(targetEntity="App\Model\Entities\Game")
     */
    protected $game;

    /**
     * @return Game
     */
    public function getGame() : Game
    {
        return $this->game;
    }

    /**
     * @param Game $game
     */
    public function setGame(Game $game)
    {
        $this->game = $game;
    }

    public function setType(bool $type)
    {
        $this->isPvE = $type;
    }

    public function isPvE() : bool
    {
        return $this->isPvE;
    }

    public function isPvP() : bool
    {
        return !$this->isPvE;
    }

    public function markAsPvE()
    {
        $this->isPvE = self::PVE;
    }

    public function markAsPvP()
    {
        $this->isPvE = self::PVP;
    }
}