vendor/novosga/core/Entity/Agendamento.php line 183

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the Novo SGA project.
  4.  *
  5.  * (c) Rogerio Lino <rogeriolino@gmail.com>
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE
  8.  * file that was distributed with this source code.
  9.  */
  10. namespace Novosga\Entity;
  11. use DateTime;
  12. /**
  13.  * Agendamento.
  14.  *
  15.  * @author rogerio
  16.  */
  17. class Agendamento implements \JsonSerializable
  18. {
  19.     const SITUACAO_AGENDADO 'agendado';
  20.     const SITUACAO_CONFIRMADO 'confirmado';
  21.     const SITUACAO_NAO_COMPARECEU 'nao_compareceu';
  22.     /**
  23.      * @var mixed
  24.      */
  25.     protected $id;
  26.     
  27.     /**
  28.      * @var DateTime
  29.      */
  30.     private $data;
  31.     
  32.     /**
  33.      * @var DateTime
  34.      */
  35.     private $hora;
  36.     /**
  37.      * @var string|null
  38.      */
  39.     private $situacao;
  40.     
  41.     /**
  42.      * @var Cliente
  43.      */
  44.     private $cliente;
  45.     
  46.     /**
  47.      * @var Unidade
  48.      */
  49.     private $unidade;
  50.     
  51.     /**
  52.      * @var Servico
  53.      */
  54.     private $servico;
  55.     
  56.     /**
  57.      * @var DateTime
  58.      */
  59.     private $dataConfirmacao;
  60.     
  61.     /**
  62.      * @var string
  63.      */
  64.     private $oid;
  65.     public function __construct()
  66.     {
  67.         $this->situacao self::SITUACAO_AGENDADO;
  68.     }
  69.     public function getId()
  70.     {
  71.         return $this->id;
  72.     }
  73.     public function getData(): ?DateTime
  74.     {
  75.         return $this->data;
  76.     }
  77.     public function getHora(): ?DateTime
  78.     {
  79.         return $this->hora;
  80.     }
  81.     public function getSituacao(): ?string
  82.     {
  83.         return $this->situacao;
  84.     }
  85.     public function getCliente(): ?Cliente
  86.     {
  87.         return $this->cliente;
  88.     }
  89.     public function getUnidade(): ?Unidade
  90.     {
  91.         return $this->unidade;
  92.     }
  93.     public function getServico(): ?Servico
  94.     {
  95.         return $this->servico;
  96.     }
  97.     
  98.     public function getDataConfirmacao(): ?DateTime
  99.     {
  100.         return $this->dataConfirmacao;
  101.     }
  102.     public function setData(?DateTime $data): self
  103.     {
  104.         $this->data $data;
  105.         return $this;
  106.     }
  107.     public function setHora(?DateTime $hora): self
  108.     {
  109.         $this->hora $hora;
  110.         return $this;
  111.     }
  112.     public function setSituacao(?string $situacao): self
  113.     {
  114.         $this->situacao $situacao;
  115.         return $this;
  116.     }
  117.     public function setCliente(?Cliente $cliente): self
  118.     {
  119.         $this->cliente $cliente;
  120.         return $this;
  121.     }
  122.     public function setUnidade(?Unidade $unidade): self
  123.     {
  124.         $this->unidade $unidade;
  125.         return $this;
  126.     }
  127.     public function setServico(?Servico $servico): self
  128.     {
  129.         $this->servico $servico;
  130.         return $this;
  131.     }
  132.     
  133.     public function setDataConfirmacao(?DateTime $dataConfirmacao): self
  134.     {
  135.         $this->dataConfirmacao $dataConfirmacao;
  136.         return $this;
  137.     }
  138.     public function getOid(): ?string
  139.     {
  140.         return $this->oid;
  141.     }
  142.     public function setOid(?string $oid): self
  143.     {
  144.         $this->oid $oid;
  145.         return $this;
  146.     }
  147.         
  148.     public function __toString()
  149.     {
  150.         return $this->getId();
  151.     }
  152.     
  153.     public function jsonSerialize()
  154.     {
  155.         return [
  156.             'id' => $this->getId(),
  157.             'cliente' => $this->getCliente(),
  158.             'servico' => $this->getServico(),
  159.             'unidade' => $this->getUnidade(),
  160.             'data' => $this->getData() ? $this->getData()->format('Y-m-d') : null,
  161.             'hora' => $this->getHora() ? $this->getHora()->format('H:i') : null,
  162.             'dataConfirmacao' => $this->getDataConfirmacao(),
  163.             'oid' => $this->getOid(),
  164.         ];
  165.     }
  166. }