<?php
namespace App\Entity;
use App\Repository\ChecklistTaskRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: ChecklistTaskRepository::class)]
class ChecklistTask
{
public const PRIORITY_LOW = 'LOW';
public const PRIORITY_MEDIUM = 'MEDIUM';
public const PRIORITY_HIGH = 'HIGH';
// Enum values for ChecklistVisibility
public const VISIBILITY_PUBLIC = 'PUBLIC';
public const VISIBILITY_PRIVATE = 'PRIVATE';
// Enum values for DependantOn
public const CHECKLIST_START_DATE = 'CHECKLIST_START_DATE';
public const CHECKLIST_END_DATE = 'CHECKLIST_END_DATE';
public const TASK = 'TASK';
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $name = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $description = null;
#[ORM\Column(length: 30, nullable: true)]
private ?string $priority = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $dueDate = null;
#[ORM\Column(nullable: true)]
private ?string $status = null;
#[ORM\Column(nullable: true)]
private ?string $dependantOn = null;
#[ORM\Column(length: 10, nullable: true)]
private ?string $visibility = null;
#[ORM\Column(nullable: true)]
private ?bool $requireDocument = null;
#[ORM\Column(nullable: true)]
private ?int $position = null;
#[ORM\OneToMany(mappedBy: 'task', targetEntity: ChecklistHowTo::class, orphanRemoval: true)]
private Collection $checklistHowTos;
#[ORM\OneToMany(mappedBy: 'task', targetEntity: ChecklistTaskDependency::class, orphanRemoval: true)]
private Collection $taskDependencies;
#[ORM\OneToMany(mappedBy: 'taskParent', targetEntity: ChecklistTaskDependency::class, orphanRemoval: true)]
private Collection $taskDependencyAsParent;
#[ORM\ManyToOne(inversedBy: 'tasks')]
#[ORM\JoinColumn(nullable: false, onDelete: 'CASCADE')]
private ?Checklist $checklist = null;
#[ORM\ManyToOne(inversedBy: 'checklistTasksAsAssignee')]
private ?User $defaultAssignee = null;
#[ORM\ManyToOne(inversedBy: 'checklistTaskAsVerifier')]
private ?User $verifier = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $document = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $comment = null;
#[ORM\OneToMany(mappedBy: 'task', targetEntity: ChecklistActivity::class)]
private Collection $checklistActivities;
#[ORM\OneToMany(mappedBy: 'task', targetEntity: ChecklistNotification::class)]
private Collection $checklistNotifications;
#[ORM\Column(nullable: true)]
private ?int $offsetInDays = null;
#[ORM\ManyToOne(targetEntity: self::class, inversedBy: 'offsetTasks')]
#[ORM\JoinColumn(onDelete: 'SET NULL')]
private ?self $offsetTask = null;
#[ORM\OneToMany(mappedBy: 'offsetTask', targetEntity: self::class)]
private Collection $offsetTasks;
#[ORM\Column(nullable: true)]
private ?\DateTimeImmutable $startDate = null;
#[ORM\Column(nullable: true)]
private ?int $durationInDays = null;
#[ORM\OneToMany(mappedBy: 'task', targetEntity: ProjectDynamicField::class, orphanRemoval: true)]
private Collection $projectDynamicFields;
public function __construct()
{
$this->checklistHowTos = new ArrayCollection();
$this->taskDependencies = new ArrayCollection();
$this->taskDependencyAsParent = new ArrayCollection();
$this->checklistActivities = new ArrayCollection();
$this->checklistNotifications = new ArrayCollection();
$this->offsetTasks = new ArrayCollection();
$this->projectDynamicFields = new ArrayCollection();
}
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 getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getPriority(): ?string
{
return $this->priority;
}
public function setPriority(?string $priority): self
{
$this->priority = $priority;
return $this;
}
public function getDueDate(): ?\DateTimeInterface
{
return $this->dueDate;
}
public function setDueDate(?\DateTimeInterface $dueDate): self
{
$this->dueDate = $dueDate;
return $this;
}
public function getVisibility(): ?string
{
return $this->visibility;
}
public function setVisibility(?string $visibility): self
{
$this->visibility = $visibility;
return $this;
}
public function isRequireDocument(): ?bool
{
return $this->requireDocument;
}
public function setRequireDocument(?bool $requireDocument): self
{
$this->requireDocument = $requireDocument;
return $this;
}
public function getPosition(): ?int
{
return $this->position;
}
public function setPosition(?int $position): self
{
$this->position = $position;
return $this;
}
/**
* @return Collection<int, ChecklistHowTo>
*/
public function getChecklistHowTos(): Collection
{
return $this->checklistHowTos;
}
public function addChecklistHowTo(ChecklistHowTo $checklistHowTo): self
{
if (!$this->checklistHowTos->contains($checklistHowTo)) {
$this->checklistHowTos->add($checklistHowTo);
$checklistHowTo->setTask($this);
}
return $this;
}
public function removeChecklistHowTo(ChecklistHowTo $checklistHowTo): self
{
if ($this->checklistHowTos->removeElement($checklistHowTo)) {
// set the owning side to null (unless already changed)
if ($checklistHowTo->getTask() === $this) {
$checklistHowTo->setTask(null);
}
}
return $this;
}
/**
* @return Collection<int, ChecklistTaskDependency>
*/
public function getTaskDependencies(): Collection
{
return $this->taskDependencies;
}
public function addTaskDependency(ChecklistTaskDependency $taskDependency): self
{
if (!$this->taskDependencies->contains($taskDependency)) {
$this->taskDependencies->add($taskDependency);
$taskDependency->setTask($this);
}
return $this;
}
public function removeTaskDependency(ChecklistTaskDependency $taskDependency): self
{
if ($this->taskDependencies->removeElement($taskDependency)) {
// set the owning side to null (unless already changed)
if ($taskDependency->getTask() === $this) {
$taskDependency->setTask(null);
}
}
return $this;
}
/**
* @return Collection<int, ChecklistTaskDependency>
*/
public function getTaskDependencyAsParent(): Collection
{
return $this->taskDependencyAsParent;
}
public function addTaskDependencyAsParent(ChecklistTaskDependency $taskDependencyAsParent): self
{
if (!$this->taskDependencyAsParent->contains($taskDependencyAsParent)) {
$this->taskDependencyAsParent->add($taskDependencyAsParent);
$taskDependencyAsParent->setTaskParent($this);
}
return $this;
}
public function removeTaskDependencyAsParent(ChecklistTaskDependency $taskDependencyAsParent): self
{
if ($this->taskDependencyAsParent->removeElement($taskDependencyAsParent)) {
// set the owning side to null (unless already changed)
if ($taskDependencyAsParent->getTaskParent() === $this) {
$taskDependencyAsParent->setTaskParent(null);
}
}
return $this;
}
public function getChecklist(): ?Checklist
{
return $this->checklist;
}
public function setChecklist(?Checklist $checklist): self
{
$this->checklist = $checklist;
return $this;
}
public function getDefaultAssignee(): ?User
{
return $this->defaultAssignee;
}
public function setDefaultAssignee(?User $defaultAssignee): self
{
$this->defaultAssignee = $defaultAssignee;
return $this;
}
public function getVerifier(): ?User
{
return $this->verifier;
}
public function setVerifier(?User $verifier): self
{
$this->verifier = $verifier;
return $this;
}
public function getDocument(): ?string
{
return $this->document;
}
public function setDocument(?string $document): self
{
$this->document = $document;
return $this;
}
public function getStatus(): ?string
{
return $this->status;
}
public function setStatus(?string $status): void
{
$this->status = $status;
}
public function getComment(): ?string
{
return $this->comment;
}
public function setComment(?string $comment): self
{
$this->comment = $comment;
return $this;
}
/**
* @return Collection<int, ChecklistActivity>
*/
public function getChecklistActivities(): Collection
{
return $this->checklistActivities;
}
public function addChecklistActivity(ChecklistActivity $checklistActivity): self
{
if (!$this->checklistActivities->contains($checklistActivity)) {
$this->checklistActivities->add($checklistActivity);
$checklistActivity->setTask($this);
}
return $this;
}
public function removeChecklistActivity(ChecklistActivity $checklistActivity): self
{
if ($this->checklistActivities->removeElement($checklistActivity)) {
// set the owning side to null (unless already changed)
if ($checklistActivity->getTask() === $this) {
$checklistActivity->setTask(null);
}
}
return $this;
}
/**
* @return Collection<int, ChecklistNotification>
*/
public function getChecklistNotifications(): Collection
{
return $this->checklistNotifications;
}
public function addChecklistNotification(ChecklistNotification $checklistNotification): self
{
if (!$this->checklistNotifications->contains($checklistNotification)) {
$this->checklistNotifications->add($checklistNotification);
$checklistNotification->setTask($this);
}
return $this;
}
public function removeChecklistNotification(ChecklistNotification $checklistNotification): self
{
if ($this->checklistNotifications->removeElement($checklistNotification)) {
// set the owning side to null (unless already changed)
if ($checklistNotification->getTask() === $this) {
$checklistNotification->setTask(null);
}
}
return $this;
}
public function getDependantOn(): ?string
{
return $this->dependantOn;
}
public function setDependantOn(?string $dependantOn)
{
$this->dependantOn = $dependantOn;
return $this;
}
public function getOffsetInDays(): ?int
{
return $this->offsetInDays;
}
public function setOffsetInDays(?int $offsetInDays): self
{
$this->offsetInDays = $offsetInDays;
return $this;
}
public function getOffsetTask(): ?self
{
return $this->offsetTask;
}
public function setOffsetTask(?self $offsetTask): self
{
$this->offsetTask = $offsetTask;
return $this;
}
/**
* @return Collection<int, self>
*/
public function getOffsetTasks(): Collection
{
return $this->offsetTasks;
}
public function addOffsetTask(self $offsetTask): self
{
if (!$this->offsetTasks->contains($offsetTask)) {
$this->offsetTasks->add($offsetTask);
$offsetTask->setOffsetTask($this);
}
return $this;
}
public function removeOffsetTask(self $offsetTask): self
{
if ($this->offsetTasks->removeElement($offsetTask)) {
// set the owning side to null (unless already changed)
if ($offsetTask->getOffsetTask() === $this) {
$offsetTask->setOffsetTask(null);
}
}
return $this;
}
public function getStartDate(): ?\DateTimeImmutable
{
return $this->startDate;
}
public function setStartDate(?\DateTimeImmutable $startDate): self
{
$this->startDate = $startDate;
return $this;
}
public function getDurationInDays(): ?int
{
return $this->durationInDays;
}
public function setDurationInDays(?int $durationInDays): self
{
$this->durationInDays = $durationInDays;
return $this;
}
/**
* @return Collection<int, ProjectDynamicField>
*/
public function getProjectDynamicFields(): Collection
{
return $this->projectDynamicFields;
}
public function addProjectDynamicField(ProjectDynamicField $projectDynamicField): self
{
if (!$this->projectDynamicFields->contains($projectDynamicField)) {
$this->projectDynamicFields->add($projectDynamicField);
$projectDynamicField->setTask($this);
}
return $this;
}
public function removeProjectDynamicField(ProjectDynamicField $projectDynamicField): self
{
if ($this->projectDynamicFields->removeElement($projectDynamicField)) {
// set the owning side to null (unless already changed)
if ($projectDynamicField->getTask() === $this) {
$projectDynamicField->setTask(null);
}
}
return $this;
}
}