<?php
namespace App\Entity\SatisfactionSurveys;
use ApiPlatform\Core\Annotation\ApiResource;
use App\Annotation\SatisfactionSurveyAware;
use App\Annotation\SiteAware;
use App\Entity\AbstractBase;
use App\Entity\Garages\Garage;
use App\Entity\Interfaces\SiteInterface;
use App\Entity\Traits\ActiveTrait;
use App\Entity\Traits\GarageTrait;
use App\Entity\Traits\SiteTrait;
use App\Repository\SatisfactionSurveys\SatisfactionSurveyCustomerResponseRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ApiResource(
* shortName="satisfaction-survey-customer-response",
* normalizationContext={"groups"={"api:read", "satisfaction_survey_customer_response:read"}, "swagger_definition_name"="Read"},
* denormalizationContext={"groups"={"api:write", "satisfaction_survey_customer_response:write", "satisfaction_survey_customer_response:put"}, "swagger_definition_name"="Write"},
* collectionOperations={"get", "post"},
* itemOperations={"get", "put"}
* )
*
* @ORM\Table(name="vulco_satisfaction_survey_customer_response", indexes={@ORM\Index(name="satisfaction_survey_customer_response_site_idx", columns={"site"})})
*
* @ORM\Entity(repositoryClass=SatisfactionSurveyCustomerResponseRepository::class)
*
* @Gedmo\SoftDeleteable(fieldName="removedAt", timeAware=false)
*
* @SatisfactionSurveyAware(satisfactionSurveyFieldName="survey_id")
*
* @SiteAware(siteFieldName="site")
*/
class SatisfactionSurveyCustomerResponse extends AbstractBase implements SiteInterface
{
use ActiveTrait;
use GarageTrait;
use SiteTrait;
/**
* @ORM\ManyToOne(targetEntity="SatisfactionSurvey", inversedBy="questions")
*
* @Groups({"api:write", "satisfaction_survey_customer_response:write"})
*/
private SatisfactionSurvey $survey;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Garages\Garage", fetch="EAGER")
*
* @Groups({"satisfaction_survey_customer_response:write"})
*/
private ?Garage $garage = null;
/**
* @ORM\OneToMany(targetEntity="SatisfactionSurveyCustomerResponseAnswer", mappedBy="response", cascade={"persist", "remove"})
*
* @Groups({"satisfaction_survey_customer_response:write"})
*/
private ?Collection $answers;
/**
* @ORM\Column(type="datetime", nullable=true)
*
* @Groups({"satisfaction_survey_customer_response:read", "satisfaction_survey_customer_response:write"})
*/
private ?\DateTimeInterface $begin = null;
/**
* @ORM\Column(type="datetime", nullable=true)
*
* @Groups({"satisfaction_survey_customer_response:read", "satisfaction_survey_customer_response:write"})
*/
private ?\DateTimeInterface $end = null;
/**
* @ORM\Column(type="text", length=10000, nullable=true)
*
* @Groups({"satisfaction_survey_customer_response:write"})
*/
private ?string $comments = null;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*
* @Groups({"satisfaction_survey_customer_response:write"})
*/
private ?string $howDidYouFindUsAnswer = null;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*
* @Groups({"satisfaction_survey_customer_response:put"})
*/
private ?string $fullname = null;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*
* @Groups({"satisfaction_survey_customer_response:put"})
*/
private ?string $email = null;
/**
* @ORM\Column(type="boolean", nullable=false, options={"default": 0})
*
* @Groups({"satisfaction_survey_customer_response:put"})
*/
private bool $wantsNewsletters = false;
/**
* @ORM\Column(type="integer", nullable=false, options={"default": 0})
*
* @Groups({"satisfaction_survey_customer_response:put"})
*/
private int $status = 0;
/**
* @ORM\Column(type="boolean", nullable=false, options={"default": 1})
*/
private bool $active = true;
public function __construct()
{
$this->answers = new ArrayCollection();
}
public function getSurvey(): SatisfactionSurvey
{
return $this->survey;
}
public function setSurvey(SatisfactionSurvey $survey): self
{
$this->survey = $survey;
return $this;
}
public function getAnswers(): ?Collection
{
return $this->answers;
}
public function setAnswers(?Collection $answers): self
{
$this->answers = $answers;
return $this;
}
public function addAnswer(SatisfactionSurveyCustomerResponseAnswer $answer): self
{
if (!$this->answers->contains($answer)) {
$answer->setResponse($this);
$this->answers->add($answer);
}
return $this;
}
public function removeAnswer(SatisfactionSurveyCustomerResponseAnswer $answer): self
{
if ($this->answers->contains($answer)) {
$this->answers->removeElement($answer);
}
return $this;
}
public function getBegin(): ?\DateTimeInterface
{
return $this->begin;
}
public function getBeginString(): string
{
return $this->getDateTimeAsString($this->getBegin());
}
public function setBegin(?\DateTimeInterface $begin): self
{
$this->begin = $begin;
return $this;
}
public function getEnd(): ?\DateTimeInterface
{
return $this->end;
}
public function getEndString(): string
{
return $this->getDateTimeAsString($this->getEnd());
}
public function setEnd(?\DateTimeInterface $end): self
{
$this->end = $end;
return $this;
}
public function getComments(): ?string
{
return $this->comments;
}
public function setComments(?string $comments): self
{
$this->comments = $comments;
return $this;
}
public function getHowDidYouFindUsAnswer(): ?string
{
return $this->howDidYouFindUsAnswer;
}
public function setHowDidYouFindUsAnswer(?string $howDidYouFindUsAnswer): self
{
$this->howDidYouFindUsAnswer = $howDidYouFindUsAnswer;
return $this;
}
public function getFullname(): ?string
{
return $this->fullname;
}
public function setFullname(?string $fullname): self
{
$this->fullname = $fullname;
return $this;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(?string $email): self
{
$this->email = $email;
return $this;
}
public function isWantsNewsletters(): bool
{
return $this->wantsNewsletters;
}
public function setWantsNewsletters(bool $wantsNewsletters): self
{
$this->wantsNewsletters = $wantsNewsletters;
return $this;
}
public function getStatus(): int
{
return $this->status;
}
public function setStatus(int $status): self
{
$this->status = $status;
return $this;
}
}