<?php
namespace App\Entity;
use App\Repository\PcConvocatoriasRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Symfony\Component\Validator\Constraints as Assert;
#[ORM\Entity(repositoryClass: PcConvocatoriasRepository::class)]
class PcConvocatorias
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[Assert\NotBlank(message: "El nombre no puede estar vacío")]
#[Assert\Length(max: 255, maxMessage: "El nombre no puede superar los 255 caracteres")]
#[ORM\Column(type: 'string', length: 255, nullable:false)]
private $nombre;
#[Assert\Length(max: 800, maxMessage: "La descripción no puede superar los 800 caracteres")]
#[ORM\Column(type: 'string', length: 800, nullable:true, unique: false)]
private $descripcion;
#[Assert\NotBlank(message: "El año no puede estar vacío")]
#[Assert\Length(min: 4, max: 4, exactMessage: "El año debe tener exactamente 4 caracteres")]
#[Assert\Regex(pattern: "/^\d{4}$/", message: "El año debe ser un valor numérico de 4 dígitos")]
#[ORM\Column(type: 'string', length: 255, nullable:false)]
private $anio;
#[ORM\Column]
private ?array $bases = [];
#[ORM\Column(type: "integer", nullable: true)]
private ?int $presupuesto = null;
#[ORM\Column(type: 'decimal', precision:10, scale:2, nullable:true)]
private $puntaje_eval_corte;
#[ORM\Column]
private array $cuestionarios = [];
#[ORM\Column]
private array $documentos = [];
#[Assert\Choice(choices: ["1", "2", "3"], message: "El estado debe ser uno de los siguientes valores: 1, 2, o 3")]
#[Assert\Length(max: 255, maxMessage: "El estado no puede superar los 255 caracteres")]
#[ORM\Column(type: 'string', nullable: true)]
private $estado;
#[ORM\OneToMany(mappedBy: 'convocatorias', targetEntity: "App\Entity\PcCriteriosConvocatorias")]
private Collection $criteriosConvocatorias;
#[ORM\OneToMany(mappedBy: 'puntoCultura', targetEntity: "App\Entity\PcPuntoCultura")]
private Collection $postulacion;
#[ORM\Column(type: 'boolean', nullable:true)]
private $apertura;
public function __construct()
{
$this->criteriosConvocatorias = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getNombre(): ?string
{
return $this->nombre;
}
public function setNombre(?string $nombre): self
{
$this->nombre = $nombre;
return $this;
}
public function getDescripcion(): ?string
{
return $this->descripcion;
}
public function setDescripcion(?string $descripcion): self
{
$this->descripcion = $descripcion;
return $this;
}
public function getAnio(): ?int
{
return $this->anio;
}
public function setAnio(?int $anio): self
{
$this->anio = $anio;
return $this;
}
public function getBases(): ?array
{
return $this->bases;
}
public function setBases(?array $bases): self
{
$this->bases = $bases;
return $this;
}
public function getPresupuesto(): ?int
{
return $this->presupuesto;
}
public function setPresupuesto(?int $presupuesto): self
{
$this->presupuesto = $presupuesto;
return $this;
}
public function getPuntajeEvalCorte(): ?float
{
return $this->puntaje_eval_corte !== null ? (float) $this->puntaje_eval_corte : null;
}
public function setPuntajeEvalCorte($puntaje_eval_corte): self
{
$this->puntaje_eval_corte = $puntaje_eval_corte;
return $this;
}
public function getCuestionarios(): array
{
return $this->cuestionarios;
}
public function setCuestionarios(array $cuestionarios): self
{
$this->cuestionarios = $cuestionarios;
return $this;
}
public function getDocumentos(): array
{
return $this->documentos;
}
public function setDocumentos(array $documentos): self
{
$this->documentos = $documentos;
return $this;
}
public function getEstado(): ?string
{
return $this->estado;
}
public function setEstado(?string $estado): self
{
$this->estado = $estado;
return $this;
}
public function getCriterios()
{
return $this->criteriosConvocatorias;
}
public function getPostulacion()
{
return $this->postulacion;
}
public function __toString(){
return $this->getNombre();
}
public function getApertura(): ?bool
{
return $this->apertura;
}
public function setApertura(?bool $apertura): self
{
$this->apertura = $apertura;
return $this;
}
}