<?php
namespace App\Entity;
use App\Repository\AffiliateServiceRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
#[ORM\Entity(repositoryClass: AffiliateServiceRepository::class)]
class AffiliateService
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\Column(type: 'string', length: 255)]
private $name;
#[ORM\Column(type: 'boolean', nullable: true)]
private $recurrent;
#[ORM\Column(type: 'float', nullable: true)]
#[Assert\Range(min: 0, max: 1)]
private $percentageOneshot;
#[ORM\Column(type: 'float', nullable: true)]
#[Assert\Range(min: 0, max: 1)]
private $percentageFirstYear;
#[ORM\Column(type: 'float', nullable: true)]
#[Assert\Range(min: 0, max: 1)]
private $percentageSecondYear;
#[ORM\Column(type: 'float', nullable: true)]
#[Assert\Range(min: 0, max: 1)]
private $percentageThirdYear;
#[ORM\OneToMany(mappedBy: 'service', targetEntity: AffiliateClientService::class)]
private $affiliateClientServices;
#[ORM\Column(type: 'float', nullable: true)]
private $defaultPrice;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $type;
public function __construct()
{
$this->affiliateClientServices = new ArrayCollection();
}
public function __toString(): string
{
return $this->name;
}
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 isRecurrent(): ?bool
{
return $this->recurrent;
}
public function setRecurrent(?bool $recurrent): self
{
$this->recurrent = $recurrent;
return $this;
}
public function getPercentageOneshot(): ?float
{
return $this->percentageOneshot;
}
public function setPercentageOneshot(?float $percentageOneshot): self
{
$this->percentageOneshot = $percentageOneshot;
return $this;
}
public function getPercentageFirstYear(): ?float
{
return $this->percentageFirstYear;
}
public function setPercentageFirstYear(?float $percentageFirstYear): self
{
$this->percentageFirstYear = $percentageFirstYear;
return $this;
}
public function getPercentageSecondYear(): ?float
{
return $this->percentageSecondYear;
}
public function setPercentageSecondYear(?float $percentageSecondYear): self
{
$this->percentageSecondYear = $percentageSecondYear;
return $this;
}
public function getPercentageThirdYear(): ?float
{
return $this->percentageThirdYear;
}
public function setPercentageThirdYear(?float $percentageThirdYear): self
{
$this->percentageThirdYear = $percentageThirdYear;
return $this;
}
/**
* @return Collection<int, AffiliateClientService>
*/
public function getAffiliateClientServices(): Collection
{
return $this->affiliateClientServices;
}
public function addAffiliateClientService(AffiliateClientService $affiliateClientService): self
{
if (!$this->affiliateClientServices->contains($affiliateClientService)) {
$this->affiliateClientServices[] = $affiliateClientService;
$affiliateClientService->setService($this);
}
return $this;
}
public function removeAffiliateClientService(AffiliateClientService $affiliateClientService): self
{
if ($this->affiliateClientServices->removeElement($affiliateClientService)) {
// set the owning side to null (unless already changed)
if ($affiliateClientService->getService() === $this) {
$affiliateClientService->setService(null);
}
}
return $this;
}
public function getDefaultPrice(): ?float
{
return $this->defaultPrice;
}
public function setDefaultPrice(?float $defaultPrice): self
{
$this->defaultPrice = $defaultPrice;
return $this;
}
public function getType(): ?string
{
return $this->type;
}
public function setType(?string $type): self
{
$this->type = $type;
return $this;
}
}