<?phpnamespace App\Entity;use App\Interfaces\CRMLead;use App\Repository\FormQuotationRepository;use App\Service\CRM\Lead;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\Validator\Constraints as Assert;/** * @ORM\Entity(repositoryClass=FormQuotationRepository::class) */class FormQuotation extends BaseForm implements CRMLead{ /** * @ORM\Column(type="string") * @Assert\Length(max="255") * @Assert\NotBlank() */ private $name; /** * @ORM\Column(type="string") * @Assert\Length(max="255") * @Assert\NotBlank() */ private $last_name; /** * @ORM\Column(type="string") * @Assert\Length(max="255") * @Assert\NotBlank() */ private $document; /** * @ORM\Column(type="string") * @Assert\Length(max="255") * @Assert\NotBlank() */ private $company; /** * @ORM\Column(type="string") * @Assert\Length(max="255") * @Assert\NotBlank() */ private $email; /** * @ORM\Column(type="string") * @Assert\Length(max="255") * @Assert\NotBlank() */ private $phone; /** * @ORM\Column(type="string") * @Assert\Length(max="255") * @Assert\NotBlank() */ private $department; /** * @ORM\Column(type="string") * @Assert\Length(max="255") * @Assert\NotBlank() */ private $model; /** * @ORM\Column(type="string") * @Assert\Length(max="255") * @Assert\NotBlank() */ private $crm_model; /** * @ORM\Column(type="text", nullable=true) */ private $message; /** * @ORM\Column(type="json", nullable=true) */ private $crm_body; /** * @ORM\Column(type="json", nullable=true) */ private $crm_result; /** * FormQuotation constructor. */ public function __construct() { parent::__construct(); } public function leadToCRM(): Lead { $lead = new Lead(); $model = $this->getCrmModel() ?? $this->getModel() ?? null; $lead ->setModel($model) ->setRuc($this->getDocument()) ->setCompany($this->getCompany()) ->setName($this->getName()) ->setLastname($this->getLastName()) ->setEmail($this->getEmail()) ->setPhone($this->getPhone()) ->setDepartment($this->getDepartment()) ->setMessage($this->getMessage()) ->setTopic('Venta') ->setCategory('Venta') ->setOriginForm('UD Trucks Cotizacion') ->setUtmSource($this->getUtmSource()) ->setUtmCampaign($this->getUtmCampaign()) ->setUtmTerm($this->getUtmTerm()) ->setUtmMedium($this->getUtmMedium()); return $lead; } public function getName(): ?string { return $this->name; } public function setName(string $name): self { $this->name = $name; return $this; } public function getLastName(): ?string { return $this->last_name; } public function setLastName(string $last_name): self { $this->last_name = $last_name; return $this; } public function getDocument(): ?string { return $this->document; } public function setDocument(string $document): self { $this->document = $document; return $this; } public function getCompany(): ?string { return $this->company; } public function setCompany(string $company): self { $this->company = $company; return $this; } public function getEmail(): ?string { return $this->email; } public function setEmail(string $email): self { $this->email = $email; return $this; } public function getPhone(): ?string { return $this->phone; } public function setPhone(string $phone): self { $this->phone = $phone; return $this; } public function getDepartment(): ?string { return $this->department; } public function setDepartment(string $department): self { $this->department = $department; return $this; } public function getModel(): ?string { return $this->model; } public function setModel(string $model): self { $this->model = $model; return $this; } public function getCrmModel(): ?string { return $this->crm_model; } public function setCrmModel(string $crm_model): self { $this->crm_model = $crm_model; return $this; } public function getMessage(): ?string { return $this->message; } public function setMessage(?string $message): self { $this->message = $message; return $this; } public function getCrmBody(): ?array { return $this->crm_body; } public function setCrmBody(?array $crm_body): self { $this->crm_body = $crm_body; return $this; } public function getCrmResult(): ?array { return $this->crm_result; } public function setCrmResult(?array $crm_result): self { $this->crm_result = $crm_result; return $this; }}