<?php
namespace App\Entity;
use App\Repository\OfferRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: OfferRepository::class)]
class Offer
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\Column(type: 'string', length: 255)]
private $name;
#[ORM\Column(type: 'string', length: 255)]
private $sportLimit;
#[ORM\Column(type: 'string', length: 255)]
private $courseLimit;
#[ORM\Column(type: 'string', length: 255)]
private $templateLimit;
#[ORM\Column(type: 'boolean')]
private $hasMessaging;
#[ORM\Column(type: 'boolean')]
private $hasChat;
#[ORM\Column(type: 'boolean')]
private $hasIframeNotation;
#[ORM\Column(type: 'boolean')]
private $hasStats;
#[ORM\Column(type: 'boolean')]
private $hasStripePayment;
#[ORM\Column(type: 'string', length: 255)]
private $annualPrice;
#[ORM\Column(type: 'string', length: 255)]
private $monthlyPrice;
#[ORM\Column(type: 'string', length: 255)]
private $billing;
#[ORM\Column(type: 'string', length: 255)]
private $stripePriceId;
#[ORM\OneToMany(targetEntity: Subscription::class, mappedBy: 'offer')]
private $subscriptions;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $description;
#[ORM\Column(type: 'integer', nullable: true)]
private $clubLimit;
#[ORM\OneToMany(targetEntity: Invoice::class, mappedBy: 'offer')]
private $invoices;
public function __construct()
{
$this->subscriptions = new ArrayCollection();
$this->invoices = new ArrayCollection();
}
public function getPrice() {
if ($this->billing == 'monthly') {
return $this->monthlyPrice;
}
else if ($this->billing == 'yearly') {
return $this->annualPrice;
}
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getSportLimit(): ?string
{
return $this->sportLimit;
}
public function setSportLimit(string $sportLimit): self
{
$this->sportLimit = $sportLimit;
return $this;
}
public function getCourseLimit(): ?string
{
return $this->courseLimit;
}
public function setCourseLimit(string $courseLimit): self
{
$this->courseLimit = $courseLimit;
return $this;
}
public function getTemplateLimit(): ?string
{
return $this->templateLimit;
}
public function setTemplateLimit(string $templateLimit): self
{
$this->templateLimit = $templateLimit;
return $this;
}
public function getHasMessaging(): ?bool
{
return $this->hasMessaging;
}
public function setHasMessaging(bool $hasMessaging): self
{
$this->hasMessaging = $hasMessaging;
return $this;
}
public function getHasChat(): ?bool
{
return $this->hasChat;
}
public function setHasChat(bool $hasChat): self
{
$this->hasChat = $hasChat;
return $this;
}
public function getHasIframeNotation(): ?bool
{
return $this->hasIframeNotation;
}
public function setHasIframeNotation(bool $hasIframeNotation): self
{
$this->hasIframeNotation = $hasIframeNotation;
return $this;
}
public function getHasStats(): ?bool
{
return $this->hasStats;
}
public function setHasStats(bool $hasStats): self
{
$this->hasStats = $hasStats;
return $this;
}
public function getHasStripePayment(): ?bool
{
return $this->hasStripePayment;
}
public function setHasStripePayment(bool $hasStripePayment): self
{
$this->hasStripePayment = $hasStripePayment;
return $this;
}
public function getAnnualPrice(): ?string
{
return $this->annualPrice;
}
public function setAnnualPrice(string $annualPrice): self
{
$this->annualPrice = $annualPrice;
return $this;
}
public function getMonthlyPrice(): ?string
{
return $this->monthlyPrice;
}
public function setMonthlyPrice(string $monthlyPrice): self
{
$this->monthlyPrice = $monthlyPrice;
return $this;
}
public function getBilling(): ?string
{
return $this->billing;
}
public function setBilling(string $billing): self
{
$this->billing = $billing;
return $this;
}
public function getStripePriceId(): ?string
{
return $this->stripePriceId;
}
public function setStripePriceId(string $stripePriceId): self
{
$this->stripePriceId = $stripePriceId;
return $this;
}
/**
* @return Collection|Subscription[]
*/
public function getSubscriptions(): Collection
{
return $this->subscriptions;
}
public function addSubscription(Subscription $subscription): self
{
if (!$this->subscriptions->contains($subscription)) {
$this->subscriptions[] = $subscription;
$subscription->setOffer($this);
}
return $this;
}
public function removeSubscription(Subscription $subscription): self
{
if ($this->subscriptions->removeElement($subscription)) {
// set the owning side to null (unless already changed)
if ($subscription->getOffer() === $this) {
$subscription->setOffer(null);
}
}
return $this;
}
public function getLabelForm()
{
return $this->getName() . ' (' . $this->getBilling().')';
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getClubLimit(): ?int
{
return $this->clubLimit;
}
public function setClubLimit(?int $clubLimit): self
{
$this->clubLimit = $clubLimit;
return $this;
}
/**
* @return Collection|Invoice[]
*/
public function getInvoices(): Collection
{
return $this->invoices;
}
public function addInvoice(Invoice $invoice): self
{
if (!$this->invoices->contains($invoice)) {
$this->invoices[] = $invoice;
$invoice->setOffer($this);
}
return $this;
}
public function removeInvoice(Invoice $invoice): self
{
if ($this->invoices->removeElement($invoice)) {
// set the owning side to null (unless already changed)
if ($invoice->getOffer() === $this) {
$invoice->setOffer(null);
}
}
return $this;
}
}