<?php
namespace App\Entity;
use App\Repository\CamaraRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpFoundation\File\File;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
#[ORM\Entity(repositoryClass: CamaraRepository::class)]
#[Vich\Uploadable]
class Camara
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $nombre = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $modelo = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $numeroSerie = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $imei = null; // 📱 Identificador del módem 4G
#[Vich\UploadableField(mapping: 'certificados_camara', fileNameProperty: 'certificado')]
private ?File $certificadoFile = null; // 📂 Archivo fÃsico
#[ORM\Column(length: 255, nullable: true)]
private ?string $certificado = null; // 📜 Nombre del archivo
#[ORM\Column(length: 255, nullable: true)]
private ?string $rtspUrl = null; // 🔹 URL de streaming RTSP
#[ORM\Column(type: 'decimal', precision: 10, scale: 7, nullable: true)]
private ?float $latitud = null;
#[ORM\Column(type: 'decimal', precision: 10, scale: 7, nullable: true)]
private ?float $longitud = null;
#[ORM\ManyToOne(targetEntity: Mandante::class)]
#[ORM\JoinColumn(nullable: true, onDelete: "SET NULL")]
private ?Mandante $mandante = null;
#[ORM\Column(options: ["default" => true])]
private ?bool $activo = true;
#[ORM\Column(type: 'datetime', nullable: true)]
private ?\DateTimeInterface $updatedAt = null;
// === Getters & Setters ===
public function getId(): ?int
{
return $this->id;
}
public function getNombre(): ?string
{
return $this->nombre;
}
public function setNombre(string $nombre): static
{
$this->nombre = $nombre;
return $this;
}
public function getModelo(): ?string
{
return $this->modelo;
}
public function setModelo(?string $modelo): static
{
$this->modelo = $modelo;
return $this;
}
public function getNumeroSerie(): ?string
{
return $this->numeroSerie;
}
public function setNumeroSerie(?string $numeroSerie): static
{
$this->numeroSerie = $numeroSerie;
return $this;
}
public function getImei(): ?string
{
return $this->imei;
}
public function setImei(?string $imei): static
{
$this->imei = $imei;
return $this;
}
public function getCertificadoFile(): ?File
{
return $this->certificadoFile;
}
public function setCertificadoFile(?File $file = null): void
{
$this->certificadoFile = $file;
if ($file) {
$this->updatedAt = new \DateTimeImmutable();
}
}
public function getCertificado(): ?string
{
return $this->certificado;
}
public function setCertificado(?string $certificado): static
{
$this->certificado = $certificado;
return $this;
}
public function getRtspUrl(): ?string
{
return $this->rtspUrl;
}
public function setRtspUrl(?string $rtspUrl): static
{
$this->rtspUrl = $rtspUrl;
return $this;
}
public function getLatitud(): ?float
{
return $this->latitud;
}
public function setLatitud(?float $latitud): static
{
$this->latitud = $latitud;
return $this;
}
public function getLongitud(): ?float
{
return $this->longitud;
}
public function setLongitud(?float $longitud): static
{
$this->longitud = $longitud;
return $this;
}
public function getMandante(): ?Mandante
{
return $this->mandante;
}
public function setMandante(?Mandante $mandante): static
{
$this->mandante = $mandante;
return $this;
}
public function isActivo(): ?bool
{
return $this->activo;
}
public function setActivo(bool $activo): static
{
$this->activo = $activo;
return $this;
}
public function getUpdatedAt(): ?\DateTimeInterface
{
return $this->updatedAt;
}
public function setUpdatedAt(?\DateTimeInterface $updatedAt): static
{
$this->updatedAt = $updatedAt;
return $this;
}
}