<?php
namespace App\Entity\Gos;
use App\Enum\CouponCombinationMode;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="App\Repository\SalesManagoCouponRepository")
*/
class SalesManagoCoupon
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $name;
/**
* @ORM\Column(type="integer", nullable=false)
*/
private $hours;
/**
* @ORM\Column(type="text", nullable=false)
*/
private $ruleId;
/**
* @var bool
*
* @ORM\Column(type="boolean", nullable=true)
*/
private $isGross;
/**
* @ORM\Column(type="boolean", nullable=true, options={"default" : 1})
*/
private $isCheckingDuplicatesEnabled;
/**
* @ORM\Column(type="boolean", nullable=true, options={"default" : 1})
*/
private $checkUser;
/**
* @ORM\Column(type="decimal", precision=10, scale=2, nullable=true)
*/
private $discount;
/**
* @ORM\Column(type="string", length=8, nullable=true)
*/
private $actionNumber;
/**
* @ORM\Column(type="string", length=100, nullable=true)
*/
private $fromSource;
/**
* @ORM\Column(type="string", length=100, nullable=true)
*/
private $campaign;
/**
* @ORM\Column(type="string", length=100, nullable=true)
*/
private $campaignChannel;
/**
* @ORM\Column(type="integer")
*/
private $maximumQuantityUse;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Gos\CouponType", inversedBy="salesManagoCoupons")
* @ORM\JoinColumn()
*/
private $couponType;
/**
* @ORM\ManyToMany(targetEntity="App\Entity\Gos\ProductVariant", inversedBy="salesManagoCoupons")
* @ORM\JoinTable(name="product_variant_sm_coupon")
*/
private $productVariant;
/**
* @ORM\ManyToMany(targetEntity="ProductVariantPack")
* @ORM\JoinTable(name="product_variant_pack_sm_coupon")
*/
private $productVariantPacks;
/**
* @ORM\ManyToMany(targetEntity="App\Entity\Gos\ProductVariant", inversedBy="salesManagoGratisCoupons")
* @ORM\JoinTable(name="product_variant_sm_gratis_coupon")
*/
private $gratis;
/**
* @var float
*
* @ORM\Column(type="float", precision=18, scale=2, nullable=true)
*/
private $gratisPriceGross;
/**
* @var float
*
* @ORM\Column(type="float", precision=18, scale=2, nullable=true)
*/
private $gratisPriceNet;
/**
* @var string
*
* @ORM\Column(name="description", type="text", nullable=true)
*/
private $description;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $appliesToPack;
/**
* @ORM\Column(type="string", nullable=false, options={"default":"none"})
*/
private $combinationMode = CouponCombinationMode::NONE;
/**
* Constructor
*/
public function __construct()
{
$this->productVariant = new \Doctrine\Common\Collections\ArrayCollection();
$this->gratis = new \Doctrine\Common\Collections\ArrayCollection();
$this->productVariantPacks = new ArrayCollection();
}
/** * Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
public function getName()
{
return $this->name;
}
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Set hours
*
* @param integer $hours
*
* @return SalesManagoCoupon
*/
public function setHours($hours)
{
$this->hours = $hours;
return $this;
}
/**
* Get hours
*
* @return integer
*/
public function getHours()
{
return $this->hours;
}
/**
* Set ruleId
*
* @param string $ruleId
*
* @return SalesManagoCoupon
*/
public function setRuleId($ruleId)
{
$this->ruleId = $ruleId;
return $this;
}
/**
* Get ruleId
*
* @return string
*/
public function getRuleId()
{
return $this->ruleId;
}
/**
* Set isGross
*
* @param boolean $isGross
*
* @return SalesManagoCoupon
*/
public function setIsGross($isGross)
{
$this->isGross = $isGross;
return $this;
}
/**
* Get isGross
*
* @return boolean
*/
public function getIsGross()
{
return $this->isGross;
}
/**
* Set isCheckingDuplicatesEnabled
*
* @param boolean $isCheckingDuplicatesEnabled
*
* @return SalesManagoCoupon
*/
public function setIsCheckingDuplicatesEnabled($isCheckingDuplicatesEnabled)
{
$this->isCheckingDuplicatesEnabled = $isCheckingDuplicatesEnabled;
return $this;
}
/**
* Get isCheckingDuplicatesEnabled
*
* @return boolean
*/
public function getIsCheckingDuplicatesEnabled()
{
return $this->isCheckingDuplicatesEnabled;
}
/**
* @param boolean $checkUser
* @return SalesManagoCoupon
*/
public function setCheckUser($checkUser): SalesManagoCoupon
{
$this->checkUser = $checkUser;
return $this;
}
/**
* @return boolean
*/
public function getCheckUser()
{
return $this->checkUser;
}
/**
* Set discount
*
* @param float $discount
*
* @return SalesManagoCoupon
*/
public function setDiscount($discount)
{
$this->discount = $discount;
return $this;
}
/**
* Get discount
*
* @return float
*/
public function getDiscount()
{
return $this->discount;
}
/**
* Set actionNumber
*
* @param string $actionNumber
*
* @return SalesManagoCoupon
*/
public function setActionNumber($actionNumber)
{
$this->actionNumber = $actionNumber;
return $this;
}
/**
* Get actionNumber
*
* @return string
*/
public function getActionNumber()
{
return $this->actionNumber;
}
/**
* Set fromSource
*
* @param string $fromSource
*
* @return SalesManagoCoupon
*/
public function setFromSource($fromSource)
{
$this->fromSource = $fromSource;
return $this;
}
/**
* Get fromSource
*
* @return string
*/
public function getFromSource()
{
return $this->fromSource;
}
/**
* Set campaign
*
* @param string $campaign
*
* @return SalesManagoCoupon
*/
public function setCampaign($campaign)
{
$this->campaign = $campaign;
return $campaign;
}
/**
* Get campaign
*
* @return string
*/
public function getCampaign()
{
return $this->campaign;
}
/**
* Set campaignChannel
*
* @param string $campaignChannel
*
* @return SalesManagoCoupon
*/
public function setCampaignChannel($campaignChannel)
{
$this->campaignChannel = $campaignChannel;
return $this;
}
/**
* Get campaignChannel
*
* @return string
*/
public function getCampaignChannel()
{
return $this->campaignChannel;
}
/**
* Set maximumQuantityUse
*
* @param integer $maximumQuantityUse
*
* @return SalesManagoCoupon
*/
public function setMaximumQuantityUse($maximumQuantityUse)
{
$this->maximumQuantityUse = $maximumQuantityUse;
return $this;
}
/**
* Get maximumQuantityUse
*
* @return integer
*/
public function getMaximumQuantityUse()
{
return $this->maximumQuantityUse;
}
/**
* Set couponType
*
* @param \App\Entity\Gos\CouponType $couponType
*
* @return SalesManagoCoupon
*/
public function setCouponType(\App\Entity\Gos\CouponType $couponType = null)
{
$this->couponType = $couponType;
return $this;
}
/**
* Get couponType
*
* @return \App\Entity\Gos\CouponType
*/
public function getCouponType()
{
return $this->couponType;
}
/**
* Add productVariant
*
* @param \App\Entity\Gos\ProductVariant $productVariant
*
* @return SalesManagoCoupon
*/
public function addProductVariant(\App\Entity\Gos\ProductVariant $productVariant)
{
$this->productVariant[] = $productVariant;
return $this;
}
/**
* Remove productVariant
*
* @param \App\Entity\Gos\ProductVariant $productVariant
*/
public function removeProductVariant(\App\Entity\Gos\ProductVariant $productVariant)
{
$this->productVariant->removeElement($productVariant);
}
/**
* Get productVariant
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getProductVariant()
{
return $this->productVariant;
}
/**
* @return Collection|ProductVariantPack[]
*/
public function getProductVariantPacks()
{
return $this->productVariantPacks;
}
public function addProductVariantPack(ProductVariantPack $productVariantPack): self
{
if (!$this->productVariantPacks->contains($productVariantPack)) {
$this->productVariantPacks[] = $productVariantPack;
}
return $this;
}
public function removeProductVariantPack(ProductVariantPack $productVariantPack): self
{
if ($this->productVariantPacks->contains($productVariantPack)) {
$this->productVariantPacks->removeElement($productVariantPack);
}
return $this;
}
/**
* Add gratis
*
* @param \App\Entity\Gos\ProductVariant $gratis
*
* @return SalesManagoCoupon
*/
public function addGrati(\App\Entity\Gos\ProductVariant $gratis)
{
$this->gratis[] = $gratis;
return $this;
}
/**
* Remove gratis
*
* @param \App\Entity\Gos\ProductVariant $gratis
*/
public function removeGrati(\App\Entity\Gos\ProductVariant $gratis)
{
$this->gratis->removeElement($gratis);
}
/**
* Get gratis
*
* @return \Doctrine\Common\Collections\ArrayCollection
*/
public function getGratis()
{
return $this->gratis;
}
/**
* Set gratisPriceGross
*
* @param float $gratisPriceGross
*
* @return SalesManagoCoupon
*/
public function setGratisPriceGross($gratisPriceGross)
{
$this->gratisPriceGross = $gratisPriceGross;
return $this;
}
/**
* Get gratisPriceGross
*
* @return float
*/
public function getGratisPriceGross()
{
return $this->gratisPriceGross;
}
/**
* Set gratisPriceNet
*
* @param float $gratisPriceNet
*
* @return SalesManagoCoupon
*/
public function setGratisPriceNet($gratisPriceNet)
{
$this->gratisPriceNet = $gratisPriceNet;
return $this;
}
/**
* Get gratisPriceNet
*
* @return float
*/
public function getGratisPriceNet()
{
return $this->gratisPriceNet;
}
/**
* Set description
*
* @param string $description
*
* @return SalesManagoCoupon
*/
public function setDescription($description)
{
$this->description = $description;
return $this;
}
/**
* Get description
*
* @return string
*/
public function getDescription()
{
return $this->description;
}
public function getAppliesToPack(): ?bool
{
return $this->appliesToPack;
}
public function setAppliesToPack(?bool $appliesToPack): self
{
$this->appliesToPack = $appliesToPack;
return $this;
}
public function setCombinationMode(string $combinationMode = CouponCombinationMode::NONE): self
{
if (!\in_array($combinationMode, [
CouponCombinationMode::NONE,
CouponCombinationMode::ALL,
CouponCombinationMode::SELECTED
], true)) {
throw new \InvalidArgumentException("Invalid status");
}
$this->combinationMode = $combinationMode;
return $this;
}
public function getCombinationMode(): string
{
return $this->combinationMode;
}
}