<?php

namespace KupShop\DeliveryPriceListBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity
 *
 * @ORM\Table(name="delivery_pricelists_regions")
 */
class Region
{
    /**
     * @ORM\Id
     *
     * @ORM\Column(type="integer")
     *
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @ORM\ManyToOne(targetEntity="PriceList")
     *
     * @ORM\JoinColumn(name="id_pricelist")
     */
    private $priceList;

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

    /**
     * @ORM\OneToMany(targetEntity="Price", mappedBy="region", cascade={"remove", "persist"})
     */
    private $regions;

    /**
     * @ORM\OneToMany(targetEntity="RegionCountry", mappedBy="region", cascade={"remove", "persist"})
     */
    private $regionCountry;

    /**
     * Get id.
     *
     * @return int
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set name.
     *
     * @param string $name
     *
     * @return Region
     */
    public function setName($name)
    {
        $this->name = $name;

        return $this;
    }

    /**
     * Get name.
     *
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Constructor.
     */
    public function __construct()
    {
        $this->regions = new \Doctrine\Common\Collections\ArrayCollection();
    }

    /**
     * Add region.
     *
     * @return Region
     */
    public function addRegion(Price $region)
    {
        $this->regions[] = $region;

        return $this;
    }

    /**
     * Remove region.
     */
    public function removeRegion(Price $region)
    {
        $this->regions->removeElement($region);
    }

    /**
     * Get regions.
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getRegions()
    {
        return $this->regions;
    }

    /**
     * Add regionCountry.
     *
     * @return Region
     */
    public function addRegionCountry(RegionCountry $regionCountry)
    {
        $this->regionCountry[] = $regionCountry;

        return $this;
    }

    /**
     * Remove regionCountry.
     */
    public function removeRegionCountry(RegionCountry $regionCountry)
    {
        $this->regionCountry->removeElement($regionCountry);
    }

    /**
     * Get regionCountry.
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getRegionCountry()
    {
        return $this->regionCountry;
    }

    /**
     * Set priceList.
     *
     * @return Region
     */
    public function setPriceList(?PriceList $priceList = null)
    {
        $this->priceList = $priceList;

        return $this;
    }

    /**
     * Get priceList.
     *
     * @return \KupShop\DeliveryPriceListBundle\Entity\PriceList
     */
    public function getPriceList()
    {
        return $this->priceList;
    }
}
