<?php

namespace KupShop\PricelistBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\Mapping\UniqueConstraint;

/**
 * Class ProductPricelist.
 *
 * @ORM\Entity
 *
 * @ORM\Table(name="pricelists_products",
 *     uniqueConstraints={@UniqueConstraint(name="pricelist_product",
 *     columns={"id_pricelist","id_product","id_variation"})})
 */
class PricelistProduct
{
    /**
     * @ORM\Id
     *
     * @ORM\Column(type="integer")
     *
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @ORM\ManyToOne(targetEntity="KupShop\PricelistBundle\Entity\Pricelist", inversedBy="product")
     *
     * @ORM\JoinColumn(name="id_pricelist", referencedColumnName="id", onDelete="CASCADE", nullable=false)
     */
    private $pricelist;

    /**
     * @ORM\ManyToOne()
     *
     * @ORM\Column(name="id_product", type="integer")
     */
    private $productId;

    /**
     * @ORM\Column(name="id_variation", type="integer", nullable=true)
     *
     * @ORM\ManyToOne(cascade={"persist", "remove"})
     */
    private $variationId;

    /**
     * @ORM\Column(type="decimal", precision=15, scale=4, nullable=true)
     */
    private $price;

    /**
     * @ORM\Column(type="decimal", scale=8, precision=12, nullable=true)
     */
    private $discount;

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

    /**
     * Set productId.
     *
     * @param int $productId
     *
     * @return PricelistProduct
     */
    public function setProductId($productId)
    {
        $this->productId = $productId;

        return $this;
    }

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

    /**
     * Set variationId.
     *
     * @param int $variationId
     *
     * @return PricelistProduct
     */
    public function setVariationId($variationId)
    {
        $this->variationId = $variationId;

        return $this;
    }

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

    /**
     * Set price.
     *
     * @param string $price
     *
     * @return PricelistProduct
     */
    public function setPrice($price)
    {
        $this->price = $price;

        return $this;
    }

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

    /**
     * Set discount.
     *
     * @param string $discount
     *
     * @return PricelistProduct
     */
    public function setDiscount($discount)
    {
        $this->discount = $discount;

        return $this;
    }

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

    /**
     * Set pricelistId.
     *
     * @return PricelistProduct
     */
    public function setPricelist(?Pricelist $pricelist = null)
    {
        $this->pricelist = $pricelist;

        return $this;
    }

    /**
     * Get pricelistId.
     *
     * @return \KupShop\PricelistBundle\Entity\Pricelist
     */
    public function getPricelist()
    {
        return $this->pricelist;
    }
}
