<?php
namespace App\Entity\Client;
use App\Entity\Project\Project;
use App\Entity\Request\RequestForm;
use App\Repository\Client\ClientRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Timestampable\Traits\TimestampableEntity;
#[ORM\Entity(repositoryClass: ClientRepository::class)]
class Client
{
use TimestampableEntity;
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $internalRef = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $name = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $token = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $deletedAt = null;
#[ORM\OneToMany(mappedBy: 'client', targetEntity: SupportUser::class)]
private Collection $supportUsers;
#[ORM\Column(nullable: true, options: ['default' => true])]
private ?bool $isEnable = true;
#[ORM\Column(length: 255, nullable: true)]
private ?string $codeClientMonday = null;
#[ORM\OneToMany(mappedBy: 'client', targetEntity: Project::class)]
private Collection $projects;
#[ORM\OneToMany(mappedBy: 'client', targetEntity: RequestForm::class)]
private Collection $requestForms;
#[ORM\Column(length: 255, nullable: true)]
private ?string $clientIdNetisse = null;
public function __construct()
{
$this->supportUsers = new ArrayCollection();
$this->projects = new ArrayCollection();
$this->requestForms = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getInternalRef(): ?string
{
return $this->internalRef;
}
public function setInternalRef(?string $internalRef): static
{
$this->internalRef = $internalRef;
return $this;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(?string $name): static
{
$this->name = $name;
return $this;
}
public function getToken(): ?string
{
return $this->token;
}
public function setToken(?string $token): static
{
$this->token = $token;
return $this;
}
public function getDeletedAt(): ?\DateTimeInterface
{
return $this->deletedAt;
}
public function setDeletedAt(?\DateTimeInterface $deletedAt): static
{
$this->deletedAt = $deletedAt;
return $this;
}
/**
* @return Collection<int, SupportUser>
*/
public function getSupportUsers(): Collection
{
return $this->supportUsers;
}
public function addSupportUser(SupportUser $supportUser): static
{
if (!$this->supportUsers->contains($supportUser)) {
$this->supportUsers->add($supportUser);
$supportUser->setClient($this);
}
return $this;
}
public function removeSupportUser(SupportUser $supportUser): static
{
if ($this->supportUsers->removeElement($supportUser)) {
// set the owning side to null (unless already changed)
if ($supportUser->getClient() === $this) {
$supportUser->setClient(null);
}
}
return $this;
}
public function isIsEnable(): ?bool
{
return $this->isEnable;
}
public function setIsEnable(?bool $isEnable): static
{
$this->isEnable = $isEnable;
return $this;
}
public function getCodeClientMonday(): ?string
{
return $this->codeClientMonday;
}
public function setCodeClientMonday(?string $codeClientMonday): static
{
$this->codeClientMonday = $codeClientMonday;
return $this;
}
/**
* @return Collection<int, Project>
*/
public function getProjects(): Collection
{
return $this->projects;
}
public function addProject(Project $project): static
{
if (!$this->projects->contains($project)) {
$this->projects->add($project);
$project->setClient($this);
}
return $this;
}
public function removeProject(Project $project): static
{
if ($this->projects->removeElement($project)) {
// set the owning side to null (unless already changed)
if ($project->getClient() === $this) {
$project->setClient(null);
}
}
return $this;
}
/**
* @return Collection<int, RequestForm>
*/
public function getRequestForms(): Collection
{
return $this->requestForms;
}
public function addRequestForm(RequestForm $requestForm): static
{
if (!$this->requestForms->contains($requestForm)) {
$this->requestForms->add($requestForm);
$requestForm->setClient($this);
}
return $this;
}
public function removeRequestForm(RequestForm $requestForm): static
{
if ($this->requestForms->removeElement($requestForm)) {
// set the owning side to null (unless already changed)
if ($requestForm->getClient() === $this) {
$requestForm->setClient(null);
}
}
return $this;
}
public function getClientIdNetisse(): ?string
{
return $this->clientIdNetisse;
}
public function setClientIdNetisse(?string $clientIdNetisse): static
{
$this->clientIdNetisse = $clientIdNetisse;
return $this;
}
}