<?php

namespace KupShop\DeliveryPriceListBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity
 *
 * @ORM\Table(name="delivery_pricelists_weight_groups")
 */
class WeightGroup
{
    /**
     * @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(name="max_weight", type="float")
     */
    private $maxWeight;

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

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

    /**
     * Set maxWeight.
     *
     * @param float $maxWeight
     *
     * @return WeightGroup
     */
    public function setMaxWeight($maxWeight)
    {
        $this->maxWeight = $maxWeight;

        return $this;
    }

    /**
     * Get maxWeight.
     *
     * @return float
     */
    public function getMaxWeight()
    {
        return $this->maxWeight;
    }

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

    /**
     * Add weightGroup.
     *
     * @return WeightGroup
     */
    public function addWeightGroup(Price $weightGroup)
    {
        $this->weightGroups[] = $weightGroup;

        return $this;
    }

    /**
     * Remove weightGroup.
     */
    public function removeWeightGroup(Price $weightGroup)
    {
        $this->weightGroups->removeElement($weightGroup);
    }

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

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

        return $this;
    }

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