<?php

namespace App\Entity;

use App\Repository\IndividualDataRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Lc\SovBundle\Doctrine\EntityInterface;
use Lc\SovBundle\Doctrine\Extension\StatusInterface;
use Lc\SovBundle\Doctrine\Extension\StatusTrait;

/**
 * @ORM\Entity(repositoryClass=IndividualDataRepository::class)
 */
class IndividualData implements StatusInterface, EntityInterface
{
    use StatusTrait;

    /**
     * @ORM\Id
     * @ORM\GeneratedValue
     * @ORM\Column(type="integer")
     */
    private $id;

    /**
     * @ORM\Column(type="string", length=255, nullable=true)
     */
    private $firstname;

    /**
     * @ORM\Column(type="string", length=255, nullable=true)
     */
    private $lastname;

    /**
     * @ORM\Column(type="string", length=255, nullable=true)
     */
    private $email;

    /**
     * @ORM\Column(type="string", length=255, nullable=true)
     */
    private $introQuestion;

    /**
     * @ORM\Column(type="string", length=255, nullable=true)
     */
    private $introAnswer;

    /**
     * @ORM\OneToMany(targetEntity=Revolt::class, mappedBy="individualData", cascade={"persist", "remove"})
     */
    private $revolt;

    /**
     * @ORM\OneToMany(targetEntity=Dream::class, mappedBy="individualData", cascade={"persist", "remove"})
     */
    private $dream;

    /**
     * @ORM\OneToMany(targetEntity=ProjectBoost::class, mappedBy="individualData", cascade={"persist", "remove"})
     */
    private $projectBoost;

    /**
     * @ORM\OneToMany(targetEntity=ProjectInspiring::class, mappedBy="individualData", cascade={"persist", "remove"})
     */
    private $projectInspiring;

    /**
     * @ORM\ManyToOne(targetEntity=Territory::class, inversedBy="individualData")
     */
    private $territory;

    public function __construct()
    {
        $this->revolt = new ArrayCollection();
        $this->dream = new ArrayCollection();
        $this->projectBoost = new ArrayCollection();
        $this->projectInspiring = new ArrayCollection();
    }

    public function __toString()
    {
        return $this->firstname . " " . $this->lastname;
    }

    public function getNbDream(): string
    {
        return count($this->getDream());
    }

    public function getNbRevolt(): string
    {
        return count($this->getRevolt());
    }

    public function getNbProjectBoost(): string
    {
        return count($this->getProjectBoost());
    }

    public function getNbProjectInspiring(): string
    {
        return count($this->getProjectInspiring());
    }

    public function getId(): ?int
    {
        return $this->id;
    }

    public function getFirstname(): ?string
    {
        return $this->firstname;
    }

    public function setFirstname(string $firstname): self
    {
        $this->firstname = $firstname;

        return $this;
    }

    public function getLastname(): ?string
    {
        return $this->lastname;
    }

    public function setLastname(string $lastname): self
    {
        $this->lastname = $lastname;

        return $this;
    }

    public function getEmail(): ?string
    {
        return $this->email;
    }

    public function setEmail(string $email): self
    {
        $this->email = $email;

        return $this;
    }

    public function getIntroQuestion(): ?string
    {
        return $this->introQuestion;
    }

    public function setIntroQuestion(string $introQuestion): self
    {
        $this->introQuestion = $introQuestion;

        return $this;
    }

    public function getIntroAnswer(): ?string
    {
        return $this->introAnswer;
    }

    public function setIntroAnswer(?string $introAnswer): self
    {
        $this->introAnswer = $introAnswer;

        return $this;
    }

    /**
     * @return Collection|Revolt[]
     */
    public function getRevolt(): Collection
    {
        return $this->revolt;
    }

    public function addRevolt(Revolt $revolt): self
    {
        if (!$this->revolt->contains($revolt)) {
            $this->revolt[] = $revolt;
            $revolt->setIndividualData($this);
        }

        return $this;
    }

    public function removeRevolt(Revolt $revolt): self
    {
        if ($this->revolt->removeElement($revolt)) {
            // set the owning side to null (unless already changed)
            if ($revolt->getIndividualData() === $this) {
                $revolt->setIndividualData(null);
            }
        }

        return $this;
    }

    /**
     * @return Collection|Dream[]
     */
    public function getDream(): Collection
    {
        return $this->dream;
    }

    public function addDream(Dream $dream): self
    {
        if (!$this->dream->contains($dream)) {
            $this->dream[] = $dream;
            $dream->setIndividualData($this);
        }

        return $this;
    }

    public function removeDream(Dream $dream): self
    {
        if ($this->dream->removeElement($dream)) {
            // set the owning side to null (unless already changed)
            if ($dream->getIndividualData() === $this) {
                $dream->setIndividualData(null);
            }
        }

        return $this;
    }

    /**
     * @return Collection|ProjectBoost[]
     */
    public function getProjectBoost(): Collection
    {
        return $this->projectBoost;
    }

    public function addProjectBoost(ProjectBoost $projectBoost): self
    {
        if (!$this->projectBoost->contains($projectBoost)) {
            $this->projectBoost[] = $projectBoost;
            $projectBoost->setIndividualData($this);
        }

        return $this;
    }

    public function removeProjectBoost(ProjectBoost $projectBoost): self
    {
        if ($this->projectBoost->removeElement($projectBoost)) {
            // set the owning side to null (unless already changed)
            if ($projectBoost->getIndividualData() === $this) {
                $projectBoost->setIndividualData(null);
            }
        }

        return $this;
    }

    /**
     * @return Collection|ProjectInspiring[]
     */
    public function getProjectInspiring(): Collection
    {
        return $this->projectInspiring;
    }

    public function addProjectInspiring(ProjectInspiring $projectInspiring): self
    {
        if (!$this->projectInspiring->contains($projectInspiring)) {
            $this->projectInspiring[] = $projectInspiring;
            $projectInspiring->setIndividualData($this);
        }

        return $this;
    }

    public function removeProjectInspiring(ProjectInspiring $projectInspiring): self
    {
        if ($this->projectInspiring->removeElement($projectInspiring)) {
            // set the owning side to null (unless already changed)
            if ($projectInspiring->getIndividualData() === $this) {
                $projectInspiring->setIndividualData(null);
            }
        }

        return $this;
    }

    public function getTerritory(): ?Territory
    {
        return $this->territory;
    }

    public function setTerritory(?Territory $territory): self
    {
        $this->territory = $territory;

        return $this;
    }
}
