<?php

namespace App\Entity;

use Doctrine\ORM\Mapping as ORM;
use App\Repository\SizeRepository;
use phpDocumentor\Reflection\Types\Integer;

/**
 * @ORM\Entity(repositoryClass=SizeRepository::class)
 */
class Size
{
    /**
     * @ORM\Id
     * @ORM\GeneratedValue
     * @ORM\Column(type="integer")
     */
    private $id;

    /**
     * @ORM\Column(type="string", length=50)
     */
    private $name;

    /**
     * @ORM\Column(type="decimal", precision=10, scale=2)
     */
    private $pvp;

    /**
     * @ORM\ManyToOne(targetEntity=Menu::class, inversedBy="size")
     */
    private $menu;

    public function getId(): ?int
    {
        return $this->id;
    }

    public function getPvp(): ?string
    {
        return $this->pvp;
    }

    public function setPvp(string $pvp): self
    {
        $this->pvp = $pvp;

        return $this;
    }

    /**
     * Get the value of menu
     */
    public function getMenu()
    {
        return $this->menu;
    }

    /**
     * Set the value of menu
     *
     * @return  self
     */
    public function setMenu($menu)
    {
        $this->menu = $menu;

        return $this;
    }

    /**
     * Get the value of name
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Set the value of name
     *
     * @return  self
     */
    public function setName($name)
    {
        $this->name = $name;

        return $this;
    }

    public function getMenuName(): string
    {
        $name = '';
        if (!empty($this->menu)) {
            $name = (string) $this->menu->getName();
        }
        return $name;
    }

    public function getMenuId(): int
    {
        $id = 0;
        if (!empty($this->menu)) {
            $id = (int) $this->menu->getId();
        }
        return $id;
    }

    public function __toString(): string
    {
        return $this->name.' - PVP:' . $this->pvp;
    }
}
