src/Entity/Reloj.php line 36

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Enum\CalibreEnum;
  4. use App\Enum\EstadoOperacionEnum;
  5. use App\Enum\EstadoRelojEnum;
  6. use App\Enum\GeneroRelojEnum;
  7. use App\Enum\PiezaRepuestoEnum;
  8. use App\Enum\ServicioMantenimientoEnum;
  9. use App\Enum\TipoCierreEnum;
  10. use App\Enum\TipoCristalEnum;
  11. use App\Enum\TipoEsferaIndiceEnum;
  12. use App\Enum\TipoOperacionEnum;
  13. use DateTime;
  14. use DateTimeInterface;
  15. use Doctrine\Common\Collections\ArrayCollection;
  16. use Doctrine\Common\Collections\Collection;
  17. use Doctrine\Common\Collections\Criteria;
  18. use Doctrine\Common\Collections\Order;
  19. use Doctrine\DBAL\Types\Types;
  20. use Doctrine\ORM\EntityNotFoundException;
  21. use Doctrine\ORM\Mapping as ORM;
  22. use JMS\Serializer\Annotation as JMS;
  23. use Gedmo\Mapping\Annotation as Gedmo;
  24. use Symfony\Component\HttpFoundation\File\File;
  25. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  26. /**
  27.  * @ORM\Entity(repositoryClass="App\Repository\RelojRepository")
  28.  * @ORM\Table(name="reloj")
  29.  * @ORM\EntityListeners({"App\EntityListener\Reloj\CalcularIDPerseoListener", "App\EntityListener\Reloj\CalcularCodigoListener"})
  30.  * @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false, hardDelete=true)
  31.  * @Vich\Uploadable
  32.  */
  33. class Reloj
  34. {
  35.     /**
  36.      * @ORM\Id
  37.      * @ORM\Column(type="bigint", options={"unsigned":true})
  38.      * @ORM\GeneratedValue(strategy="AUTO")
  39.      * @JMS\Groups({
  40.      *       "api_v1_reloj_serialize",
  41.      *       "api_v1_valoracion_serialize",
  42.      *       "api_v1_operacion_show_serialize",
  43.      *       "api_v1_promocion_serialize"
  44.      *   })
  45.      */
  46.     protected $id;
  47.     /**
  48.      * @ORM\Column(type="string", unique=true, nullable=false)
  49.      * @JMS\Groups({
  50.      *        "api_v1_reloj_serialize",
  51.      *        "api_v1_valoracion_serialize",
  52.      *        "api_v1_operacion_show_serialize",
  53.      *        "api_v1_promocion_serialize",
  54.      *        "api_v1_promocion_serialize"
  55.      *    })
  56.      */
  57.     protected $codigo;
  58.     /**
  59.      * @ORM\Column(
  60.      *     type="string",
  61.      *     unique=true,
  62.      *     nullable=false,
  63.      *     name="id_perseo",
  64.      *     options={"comment":"Identificador de perseo único generado aleatoriamente combinación letras y números"}
  65.      * )
  66.      * @JMS\Groups({
  67.      *        "api_v1_reloj_serialize",
  68.      *        "api_v1_valoracion_serialize",
  69.      *        "api_v1_operacion_show_serialize",
  70.      *        "api_v1_promocion_serialize"
  71.      *    })
  72.      */
  73.     protected $IDperseo;
  74.     /**
  75.      * @ORM\Column(
  76.      *     type="string",
  77.      *     length=4,
  78.      *     nullable=true,
  79.      *     options={"comment":"Valores a tomar REBU ó IVA, por defecto REBU"}
  80.      * )
  81.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  82.      */
  83.     protected $regimen;
  84.     /**
  85.      * @ORM\Column(type="string", nullable=true)
  86.      * @JMS\Groups({
  87.      *     "api_v1_reloj_serialize",
  88.      *     "api_v1_valoracion_serialize",
  89.      *     "api_v1_operacion_show_serialize",
  90.      *     "api_v1_promocion_serialize"
  91.      * })
  92.      */
  93.     protected $foto;
  94.     /**
  95.      * @Vich\UploadableField(mapping="reloj", fileNameProperty="foto")
  96.      * @var File
  97.      */
  98.     protected $fotoFile;
  99.     /**
  100.      * @ORM\Column(type="string", nullable=true, name="foto_valoracion")
  101.      * @JMS\Groups({
  102.      *     "api_v1_reloj_serialize",
  103.      *     "api_v1_valoracion_serialize"
  104.      * })
  105.      */
  106.     private $fotoValoracion;
  107.     /**
  108.      * @Vich\UploadableField(mapping="reloj", fileNameProperty="foto_valoracion")
  109.      * @var File
  110.      */
  111.     protected $fotoValoracionFile;
  112.     /**
  113.      * @ORM\Column(type="string", nullable=true, name="foto_set")
  114.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  115.      */
  116.     private $fotoSet;
  117.     /**
  118.      * @Vich\UploadableField(mapping="reloj", fileNameProperty="foto_set")
  119.      * @var File
  120.      */
  121.     protected $fotoSetFile;
  122.     /**
  123.      * @ORM\Column(type="string", nullable=true, name="foto_crono", options={"comment":"foto del cronocomparador"})
  124.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  125.      */
  126.     private $fotoCrono;
  127.     /**
  128.      * @Vich\UploadableField(mapping="reloj", fileNameProperty="foto_crono")
  129.      * @var File
  130.      */
  131.     protected $fotoCronoFile;
  132.     /**
  133.      * @ORM\Column(type="string", nullable=true)
  134.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  135.      */
  136.     private $video;
  137.     /**
  138.      * @Vich\UploadableField(mapping="reloj", fileNameProperty="video")
  139.      * @var File
  140.      */
  141.     protected $videoFile;
  142.     /**
  143.      * @ORM\Column(type="string", nullable=true)
  144.      * @JMS\Groups({
  145.      *        "api_v1_reloj_serialize",
  146.      *        "api_v1_valoracion_serialize",
  147.      *        "api_v1_operacion_show_serialize",
  148.      *        "api_v1_promocion_serialize"
  149.      *    })
  150.      */
  151.     protected $modelo1;
  152.     /**
  153.      * @ORM\Column(type="string", nullable=true)
  154.      * @JMS\Groups({
  155.      *        "api_v1_reloj_serialize",
  156.      *        "api_v1_valoracion_serialize",
  157.      *        "api_v1_operacion_show_serialize",
  158.      *        "api_v1_promocion_serialize"
  159.      *    })
  160.      */
  161.     protected $modelo2;
  162.     /**
  163.      * @ORM\Column(type="string", nullable=true)
  164.      * @JMS\Groups({
  165.      *        "api_v1_reloj_serialize",
  166.      *        "api_v1_valoracion_serialize",
  167.      *        "api_v1_operacion_show_serialize",
  168.      *        "api_v1_promocion_serialize",
  169.      *    })
  170.      */
  171.     protected $ref1;
  172.     /**
  173.      * @ORM\Column(type="string", nullable=true)
  174.      * @JMS\Groups({
  175.      *        "api_v1_reloj_serialize",
  176.      *        "api_v1_valoracion_serialize",
  177.      *        "api_v1_operacion_show_serialize",
  178.      *        "api_v1_promocion_serialize"
  179.      *    })
  180.      */
  181.     protected $ref2;
  182.     /**
  183.      * @ORM\Column(type="string", nullable=true)
  184.      * @JMS\Groups({
  185.      *     "api_v1_reloj_serialize",
  186.      *     "api_v1_valoracion_serialize",
  187.      *     "api_v1_operacion_show_serialize",
  188.      *     "api_v1_promocion_serialize"
  189.      * })
  190.      */
  191.     protected $serie;
  192.     /**
  193.      * @ORM\Column(type="float", nullable=true, precision=2)
  194.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  195.      */
  196.     protected $peso;
  197.     /**
  198.      * @ORM\Column(type="datetime", nullable=true, options={"comment":"Fecha comprado por  primera vez"})
  199.      * @JMS\Groups({
  200.      *     "api_v1_reloj_serialize",
  201.      *     "api_v1_valoracion_serialize",
  202.      *     "api_v1_operacion_show_serialize",
  203.      *     "api_v1_promocion_serialize"
  204.      * })
  205.      */
  206.     protected $fecha;
  207.     /**
  208.      * @ORM\Column(type="boolean", nullable=false, options={"default":0})
  209.      * @JMS\Groups({
  210.      *      "api_v1_reloj_serialize",
  211.      *      "api_v1_valoracion_serialize",
  212.      *      "api_v1_operacion_show_serialize",
  213.      *      "api_v1_promocion_serialize"
  214.      *  })
  215.      */
  216.     protected $caja;
  217.     /**
  218.      * @ORM\Column(type="boolean", nullable=false, options={"default":0})
  219.      * @JMS\Groups({
  220.      *      "api_v1_reloj_serialize",
  221.      *      "api_v1_valoracion_serialize",
  222.      *      "api_v1_operacion_show_serialize",
  223.      *      "api_v1_promocion_serialize"
  224.      *  })
  225.      */
  226.     protected $papeles;
  227.     /**
  228.      * @ORM\Column(type="text", nullable=true)
  229.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  230.      */
  231.     protected $otros;
  232.     /**
  233.      * @ORM\Column(type="float", nullable=true, name="itp", precision=2, options={"default":"0.0","comment":"%"})
  234.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  235.      */
  236.     protected $ITP;
  237.     /**
  238.      * @ORM\Column(
  239.      *     type="datetime",
  240.      *     nullable=true,
  241.      *     name="fecha_valoracion",
  242.      *     options={"comment":"Fecha valoracion es la fecha enviada"}
  243.      * )
  244.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  245.      */
  246.     private $fechaValoracion;
  247.     /**
  248.      * @ORM\Column(
  249.      *     type="float",
  250.      *     nullable=true,
  251.      *     options={
  252.      *         "default":"0.0",
  253.      *         "comment":"Comsión CRONO esta en gastos , pero se duplica fuera para tener mejor acceso a ella %"
  254.      *     }
  255.      * )
  256.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  257.      */
  258.     protected $comision;
  259.     /**
  260.      * @ORM\Column(type="float", nullable=true, precision=2, name="precio_coste")
  261.      * @JMS\Groups({
  262.      *     "api_v1_reloj_serialize",
  263.      *     "api_v1_valoracion_serialize"
  264.      * })
  265.      */
  266.     protected $precioCoste;
  267.     /**
  268.      * @ORM\Column(
  269.      *     type="float",
  270.      *     nullable=true,
  271.      *     name="precio_coste_total",
  272.      *     precision=2,
  273.      *     options={
  274.      *         "default":"0.0",
  275.      *         "comment":"Autocalculado, cada vez que se añade/modifique un coste ó cambie su coste (Coste del Reloj + Costes Asociados)"
  276.      *     }
  277.      * )
  278.      * @JMS\Groups({
  279.      *     "api_v1_reloj_serialize",
  280.      *     "api_v1_valoracion_serialize",
  281.      *     "api_v1_operacion_show_serialize",
  282.      *     "api_v1_promocion_serialize"
  283.      * })
  284.      */
  285.     protected $precioCosteTotal;
  286.     /**
  287.      * @ORM\Column(
  288.      *     type="string",
  289.      *     nullable=true,
  290.      *     name="genero",
  291.      *     enumType="App\Enum\GeneroRelojEnum",
  292.      *     options={"comment":"Opciones caballero, mujer, unisex"}
  293.      * )
  294.      */
  295.     private $genero;
  296.     /**
  297.      * @ORM\Column(
  298.      *     type="smallint",
  299.      *     length=1,
  300.      *     nullable=true,
  301.      *     name="estado_caja",
  302.      *     options={"comment":"valores a tomar de 1 a 5"}
  303.      * )
  304.      */
  305.     private $estadoCaja;
  306.     /**
  307.      * @ORM\Column(
  308.      *     type="smallint",
  309.      *     length=1,
  310.      *     nullable=true,
  311.      *     name="estado_cristal",
  312.      *     options={"comment":"valores a tomar de 1 a 5"}
  313.      * )
  314.      */
  315.     private $estadoCristal;
  316.     /**
  317.      * @ORM\Column(
  318.      *     type="smallint",
  319.      *     length=1,
  320.      *     nullable=true,
  321.      *     name="estado_dial",
  322.      *     options={"comment":"valores a tomar de 1 a 5"}
  323.      * )
  324.      */
  325.     private $estadoDial;
  326.     /**
  327.      * @ORM\Column(
  328.      *     type="smallint",
  329.      *     length=1,
  330.      *     nullable=true,
  331.      *     name="estado_agujas",
  332.      *     options={"comment":"valores a tomar de 1 a 5"}
  333.      * )
  334.      */
  335.     private $estadoAgujas;
  336.     /**
  337.      * @ORM\Column(
  338.      *     type="smallint",
  339.      *     length=1,
  340.      *     nullable=true,
  341.      *     name="estado_tapa",
  342.      *     options={"comment":"valores a tomar de 1 a 5"}
  343.      * )
  344.      */
  345.     private $estadoTapa;
  346.     /**
  347.      * @ORM\Column(
  348.      *     type="smallint",
  349.      *     length=1,
  350.      *     nullable=true,
  351.      *     name="estado_correa",
  352.      *     options={"comment":"valores a tomar de 1 a 5"}
  353.      * )
  354.      */
  355.     private $estadoCorrea;
  356.     /**
  357.      * @ORM\Column(
  358.      *     type="string",
  359.      *     nullable=true,
  360.      *     enumType="App\Enum\TipoEsferaIndiceEnum",
  361.      *     name="esfera_indice",
  362.      *     options={"comment":"Opciones Arabes, Romanos, Indices, Sin Indices"}
  363.      * )
  364.      */
  365.     private $esferaIndice;
  366.     /**
  367.      * @ORM\Column(type="string", nullable=true, name="esfera_color")
  368.      */
  369.     private $esferaColor;
  370.     /**
  371.      * @ORM\Column(type="boolean", nullable=true, name="esfera_joyas", options={"default":0})
  372.      */
  373.     private $esferaJoyas;
  374.     /**
  375.      * @ORM\Column(type="integer", nullable=true, name="caja_reloj_diametro", options={"comment":"medidas en mm"})
  376.      */
  377.     private $cajaRelojDiametro;
  378.     /**
  379.      * @ORM\Column(type="integer", nullable=true, name="caja_reloj_grosor", options={"comment":"Medidas en mm"})
  380.      */
  381.     private $cajaRelojGrosor;
  382.     /**
  383.      * @ORM\Column(type="integer", nullable=true, name="caja_reloj_resistencia_agua", options={"comment":"Unidad ATM"})
  384.      */
  385.     private $cajaRelojResistenciaAgua;
  386.     /**
  387.      * @ORM\Column(
  388.      *     type="string",
  389.      *     nullable=true,
  390.      *     enumType="App\Enum\TipoCristalEnum",
  391.      *     name="caja_reloj_cristal",
  392.      *     options={"comment":"Opciones Zafiro, Mineral, Plexiglass"}
  393.      * )
  394.      */
  395.     private $cajaRelojCristal;
  396.     /**
  397.      * @ORM\Column(type="string", nullable=true, name="pulsera_color")
  398.      */
  399.     private $pulseraColor;
  400.     /**
  401.      * @ORM\Column(
  402.      *     type="string",
  403.      *     nullable=true,
  404.      *     name="pulsera_cierre",
  405.      *     enumType="App\Enum\TipoCierreEnum",
  406.      *     options={"comment":"Opciones hebilla, deployante"}
  407.      * )
  408.      */
  409.     private $pulseraCierre;
  410.     /**
  411.      * @ORM\Column(type="integer", nullable=true, name="pulsera_ancho_caja")
  412.      */
  413.     private $pulseraAnchoCaja;
  414.     /**
  415.      * @ORM\Column(type="integer", nullable=true, name="pulsera_ancho_cierre")
  416.      */
  417.     private $pulseraAnchoCierre;
  418.     /**
  419.      * @ORM\Column(type="integer", nullable=true, name="pulsera_medida_munieca")
  420.      */
  421.     private $pulseraMedidaMunieca;
  422.     /**
  423.      * @ORM\Column(
  424.      *     type="string",
  425.      *     nullable=true,
  426.      *     enumType="App\Enum\CalibreEnum",
  427.      *     options={"comment":"Opciones automático, manual, cuarzo, solar"}
  428.      * )
  429.      */
  430.     private $calibre;
  431.     /**
  432.      * @ORM\Column(type="string", nullable=true, name="calibre_avanzado")
  433.      */
  434.     private $calibreAvanzado;
  435.     /**
  436.      * @ORM\Column(type="string", nullable=true, name="calibre_basico")
  437.      */
  438.     private $calibreBasico;
  439.     /**
  440.      * @ORM\Column(type="string", nullable=true, name="calibre_reserva_marcha")
  441.      */
  442.     private $calibreReservaMarcha;
  443.     /**
  444.      * @ORM\Column(type="string", nullable=true, name="calibre_numero_joyas")
  445.      */
  446.     private $calibreNumeroJoyas;
  447.     /**
  448.      * @ORM\Column(type="string", nullable=true, name="calibre_oscilacion")
  449.      */
  450.     private $calibreOscilacion;
  451.     /**
  452.      * @ORM\Column(type="string", nullable=true, name="calibre_amplitud")
  453.      */
  454.     private $calibreAmplitud;
  455.     /**
  456.      * @ORM\Column(type="string", nullable=true, name="calibre_marcha")
  457.      */
  458.     private $calibreMarcha;
  459.     /**
  460.      * @ORM\Column(
  461.      *     type="string",
  462.      *     nullable=true,
  463.      *     enumType="App\Enum\PiezaRepuestoEnum",
  464.      *     name="piezas_repuesto",
  465.      *     options={"comment":"Opciones Si, No, No lo sé"}
  466.      * )
  467.      */
  468.     private $piezasRepuesto;
  469.     /**
  470.      * @ORM\Column(type="text", nullable=true, name="piezas_repuesto_observaciones")
  471.      */
  472.     private $piezasRepuestoObservaciones;
  473.     /**
  474.      * @ORM\Column(
  475.      *     type="string",
  476.      *     nullable=true,
  477.      *     enumType="App\Enum\ServicioMantenimientoEnum",
  478.      *     name="servicio_mantenimiento",
  479.      *     options={"comment":"Opciones Si, oficial; Si, relojero propio; No; No lo se"}
  480.      * )
  481.      */
  482.     private $servicioMantenimiento;
  483.     /**
  484.      * @ORM\Column(
  485.      *     type="json",
  486.      *     nullable=true,
  487.      *     name="calibre_caracteristicas",
  488.      *     options={"comment":"Opciones de caracteristicas (selector multiple)"}
  489.      * )
  490.      */
  491.     private $calibreCaracteristicas;
  492.     /**
  493.      * @ORM\Column(
  494.      *     type="json",
  495.      *     nullable=true,
  496.      *     name="calibre_funciones",
  497.      *     options={"comment":"Opciones de caracteristicas (selector multiple)"}
  498.      * )
  499.      */
  500.     private $calibreFunciones;
  501.     /**
  502.      * @ORM\Column(type="float", nullable=true, precision=2, name="precio_min_venta")
  503.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  504.      */
  505.     protected $precioMinVenta;
  506.     /**
  507.      * @ORM\Column(type="float", nullable=true, precision=2, name="precio_promocion", options={"default":"0.0"})
  508.      * @JMS\Groups({
  509.      *     "api_v1_reloj_serialize",
  510.      *     "api_v1_valoracion_serialize",
  511.      *     "api_v1_operacion_show_serialize"
  512.      * })
  513.      */
  514.     protected $precioPromocion;
  515.     /**
  516.      * @ORM\Column(type="datetime", nullable=true, name="fecha_promocion")
  517.      * @JMS\Groups({
  518.      *     "api_v1_reloj_serialize",
  519.      *     "api_v1_valoracion_serialize"
  520.      * })
  521.      */
  522.     protected $fechaPromocion;
  523.     /**
  524.      * @ORM\Column(type="float", nullable=true, precision=2, name="precio_oferta")
  525.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  526.      */
  527.     protected $precioOferta;
  528.     /**
  529.      * @deprecated Por cambios de funcionalidad
  530.      * @ORM\Column(type="boolean", nullable=true, precision=2, name="chrono24")
  531.      */
  532.     protected $chrono24;
  533.     /**
  534.      * @ORM\Column(type="float", nullable=true, precision=2, name="precio_pagar")
  535.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  536.      */
  537.     protected $precioPagar;
  538.     /**
  539.      * @ORM\Column(
  540.      *     type="boolean",
  541.      *     nullable=true,
  542.      *     options={
  543.      *         "default":1,
  544.      *         "comment":"Valor por defecto: **true**.
  545.      *         Cuando la operación se origina dentro de un proceso de **gestión**, el valor se establece en **false**.
  546.      *         Este campo permite identificar si una compra ha sido realizada **fuera del circuito de gestión**, independientemente de que el reloj esté o haya estado previamente vinculado a una operación de gestión."
  547.      *     }
  548.      * )
  549.      */
  550.     private $compraDirecta;
  551.     /**
  552.      * @ORM\Column(type="float", nullable=true, precision=2, name="precio_compra")
  553.      * @JMS\Groups({
  554.      *     "api_v1_reloj_serialize",
  555.      *     "api_v1_valoracion_serialize",
  556.      *     "api_v1_promocion_serialize"
  557.      * })
  558.      */
  559.     protected $precioCompra;
  560.     /**
  561.      * @ORM\Column(type="datetime", nullable=true, name="fecha_compra")
  562.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  563.      * @JMS\Groups({
  564.      *         "api_v1_reloj_serialize",
  565.      *         "api_v1_promocion_serialize"
  566.      *     })
  567.      */
  568.     protected $fechaCompra;
  569.     /**
  570.      * @ORM\Column(type="float", nullable=true, precision=2)
  571.      * @JMS\Groups({
  572.      *        "api_v1_valoracion_serialize",
  573.      *        "api_v1_reloj_serialize"
  574.      *    })
  575.      */
  576.     protected $precioVenta;
  577.     /**
  578.      * @ORM\Column(type="datetime", nullable=true, name="fecha_venta")
  579.      * @JMS\Groups({
  580.      *        "api_v1_valoracion_serialize",
  581.      *        "api_v1_reloj_serialize"
  582.      *    })
  583.      */
  584.     protected $fechaVenta;
  585.     /**
  586.      * @ORM\Column(type="float", nullable=true, precision=2)
  587.      * @JMS\Groups({
  588.      *     "api_v1_reloj_serialize",
  589.      *     "api_v1_valoracion_serialize",
  590.      *     "api_v1_operacion_show_serialize"
  591.      * })
  592.      */
  593.     protected $precioVentaTotal;
  594.     /**
  595.      * @ORM\Column(type="datetime", nullable=true, name="fecha_baja")
  596.      * @JMS\Groups({
  597.      *        "api_v1_valoracion_serialize",
  598.      *        "api_v1_reloj_serialize"
  599.      *    })
  600.      */
  601.     protected $fechaBaja;
  602.     /**
  603.      * @ORM\Column(type="float", nullable=true, precision=0, name="margen_minimo")
  604.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  605.      */
  606.     protected $margenMinimo;
  607.     /**
  608.      * @ORM\Column(type="float", nullable=true, precision=0, name="margen_deseado")
  609.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  610.      */
  611.     protected $margenDeseado;
  612.     /**
  613.      * @ORM\Column(type="float", nullable=true, precision=2)
  614.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  615.      */
  616.     private $recompra;
  617.     /**
  618.      * @ORM\Column(type="string", nullable=true)
  619.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  620.      */
  621.     private $garantia;
  622.     /**
  623.      * @ORM\Column(type="string", nullable=true)
  624.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  625.      */
  626.     private $descripcion;
  627.     /**
  628.      * @ORM\Column(type="text", nullable=true, name="descripcion_detallada")
  629.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  630.      */
  631.     private $descripcionDetallada;
  632.     /**
  633.      * @ORM\Column(type="text", nullable=true)
  634.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  635.      */
  636.     private $condiciones;
  637.     /**
  638.      * @ORM\Column(type="text", nullable=true, name="anuncio_es")
  639.      */
  640.     private $anuncioES;
  641.     /**
  642.      * @ORM\Column(type="text", nullable=true, name="anuncio_en")
  643.      */
  644.     private $anuncioEN;
  645.     /**
  646.      * @ORM\Column(
  647.      *     type="integer",
  648.      *     nullable=true,
  649.      *     name="tiempo_en_venta",
  650.      *     options={"comment":"Diff entre Fecha Venta y 1º Estado de Anuncio"}
  651.      * )
  652.      * @JMS\Groups({
  653.      *     "api_v1_valoracion_serialize",
  654.      *     "api_v1_promocion_serialize"
  655.      * })
  656.      */
  657.     private $tiempoEnVenta;
  658.     /**
  659.      * @ORM\Column(
  660.      *     type="integer",
  661.      *     nullable=true,
  662.      *     name="tiempo_en_stock",
  663.      *     options={"comment":"Diff entre Fecha Venta y Fecha Compra"}
  664.      * )
  665.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  666.      */
  667.     private $tiempoEnStock;
  668.     /**
  669.      * @ORM\Column(type="datetime", nullable=true, name="fecha_recepcion")
  670.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  671.      */
  672.     private $fechaRecepcion;
  673.     /**
  674.      * @ORM\Column(
  675.      *     type="float",
  676.      *     nullable=true,
  677.      *     precision=0,
  678.      *     name="margen_promocion",
  679.      *     options={"default":"0.0","comment":"%"}
  680.      * )
  681.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  682.      */
  683.     protected $margenPromocion;
  684.     /**
  685.      * @ORM\Column(
  686.      *     type="float",
  687.      *     nullable=true,
  688.      *     precision=0,
  689.      *     name="margen_bruto",
  690.      *     options={"default":"0.0","comment":"%"}
  691.      * )
  692.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  693.      */
  694.     protected $margenBruto;
  695.     /**
  696.      * @ORM\Column(type="float", nullable=true, name="margen_neto", precision=2,
  697.      *     options={"default":"0.0","comment":"%"})
  698.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  699.      */
  700.     protected $margenNeto;
  701.     /**
  702.      * @ORM\Column(type="boolean", nullable=false, options={"default":0,"comment":"Relojes comprados"})
  703.      * @JMS\Groups({"api_v1_reloj_serialize"})
  704.      */
  705.     protected $stock;
  706.     /**
  707.      * @ORM\Column(type="boolean", nullable=true, options={"default":0,"comment":"Relojes en Gestión de Venta"})
  708.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  709.      */
  710.     protected $custodia;
  711.     /**
  712.      * @ORM\Column(type="float", nullable=true, name="tiempo_venta", precision=2,
  713.      *     options={"default":"0.0","comment":"%"})
  714.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  715.      */
  716.     protected $tiempoVenta;
  717.     /**
  718.      * @ORM\Column(type="datetime", nullable=true, name="fecha_anuncio", options={"comment":"Fecha primer anuncio"})
  719.      * @JMS\Groups({
  720.      *     "api_v1_reloj_serialize",
  721.      *     "api_v1_valoracion_serialize"
  722.      * })
  723.      */
  724.     private $fechaAnuncio;
  725.     /**
  726.      * @ORM\Column(type="text", nullable=true)
  727.      * @JMS\Groups({
  728.      *     "api_v1_reloj_serialize",
  729.      *     "api_v1_valoracion_serialize"
  730.      * })
  731.      */
  732.     protected $comentario;
  733.     /**
  734.      * @ORM\Column(
  735.      *     type="string",
  736.      *     unique=true,
  737.      *     nullable=true,
  738.      *     name="token_access",
  739.      *     options={"comment":"Token de acceso a la información del reloj"}
  740.      * )
  741.      */
  742.     protected $tokenAccess;
  743.     /**
  744.      * @ORM\Column(
  745.      *     type="boolean",
  746.      *     nullable=true,
  747.      *     name="en_promocion",
  748.      *     options={"default":0,"comment":"Cuando la Estado Operacion es Confirmada"}
  749.      * )
  750.      */
  751.     protected $enPromocion;
  752.     /**
  753.      * @ORM\Column(
  754.      *     type="boolean",
  755.      *     nullable=true,
  756.      *     name="en_servicio",
  757.      *     options={"default":0,"comment":"Relojes Recepcionados y que se encuentren en una Ubicación tipo Proveedor"}
  758.      * )
  759.      */
  760.     protected $enServicio;
  761.     /**
  762.      * @ORM\Column(
  763.      *     type="boolean",
  764.      *     nullable=true,
  765.      *     name="sin_anunciar",
  766.      *     options={"default":0,"comment":"Relojes Estado Listo y no han sido promocionados"}
  767.      * )
  768.      */
  769.     protected $sinAnunciar;
  770.     /**
  771.      * @ORM\Column(type="boolean", nullable=true, options={"default":0})
  772.      */
  773.     protected $enVenta;
  774.     /**
  775.      * @ORM\Column(
  776.      *     type="boolean",
  777.      *     nullable=true,
  778.      *     name="tipo_bloqueo",
  779.      *     options={"comment":"Valores a tomar RM(true) ó RI(false) ó NULL"}
  780.      * )
  781.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  782.      */
  783.     protected $tipoBloqueo;
  784.     /**
  785.      * @ORM\Column(type="boolean", nullable=true)
  786.      * @JMS\Groups({"api_v1_valoracion_serialize"})
  787.      */
  788.     protected $exportacion;
  789.     /**
  790.      * @ORM\Column(type="datetime", nullable=true, name="deleted_at")
  791.      * @JMS\Groups({
  792.      *        "api_v1_valoracion_serialize",
  793.      *        "api_v1_reloj_serialize",
  794.      *        "api_v1_promocion_serialize"
  795.      *    })
  796.      */
  797.     protected $deletedAt;
  798.     /**
  799.      * @ORM\Column(type="datetime", nullable=false, name="updated_at", options={"default":"2022-01-01 00:00:00"})
  800.      * @Gedmo\Timestampable(on="update")
  801.      */
  802.     protected $updatedAt;
  803.     /**
  804.      * @ORM\Column(type="datetime", nullable=false, name="created_at", options={"default":"2022-01-01 00:00:00"})
  805.      * @Gedmo\Timestampable(on="create")
  806.      * @JMS\Groups({
  807.      *        "api_v1_reloj_serialize",
  808.      *        "api_v1_valoracion_serialize",
  809.      *        "api_v1_operacion_show_serialize",
  810.      *        "api_v1_promocion_serialize"
  811.      *    })
  812.      */
  813.     protected $createdAt;
  814.     /**
  815.      * @ORM\OneToOne(targetEntity=\App\Entity\ValoracionesRelojesSinStock::class, mappedBy="relojInventario")
  816.      */
  817.     private $valoracionReloj;
  818.     /**
  819.      * @ORM\OneToMany(targetEntity=\App\Entity\DetalleCompra::class, mappedBy="reloj")
  820.      */
  821.     protected $detalleCompra;
  822.     /**
  823.      * @ORM\OneToMany(targetEntity=\App\Entity\DetalleCompra::class, mappedBy="relojBase")
  824.      */
  825.     private $relojesDerivadosDetalleCompra;
  826.     /**
  827.      * @ORM\OneToMany(targetEntity=\App\Entity\DetalleVenta::class, mappedBy="reloj")
  828.      */
  829.     protected $detalleVenta;
  830.     /**
  831.      * @ORM\OneToOne(targetEntity=\App\Entity\RegistroPolicial::class, mappedBy="reloj")
  832.      */
  833.     protected $registroPolicial;
  834.     /*
  835.      * @ORM\OneToOne(targetEntity=\App\Entity\ActividadAbstract::class, mappedBy="reloj")
  836.      */
  837.     private $actividad;
  838.     /**
  839.      * @ORM\OneToOne(targetEntity=\App\Entity\Promocion::class, mappedBy="reloj")
  840.      */
  841.     protected $promociones;
  842.     /**
  843.      * @ORM\OneToMany(targetEntity="App\Entity\Gasto", mappedBy="reloj")
  844.      */
  845.     protected $gastos;
  846.     /**
  847.      * @ORM\OneToMany(targetEntity="App\Entity\Trazabilidad", mappedBy="reloj")
  848.      */
  849.     protected $trazas;
  850.     /**
  851.      * @ORM\OneToMany(targetEntity="App\Entity\ValoracionesRelojes", mappedBy="reloj", cascade={"persist"})
  852.      */
  853.     protected $valoracionesRelojes;
  854.     /**
  855.      * @ORM\OneToMany(targetEntity=\App\Entity\ValoracionesRelojesSinStock::class, mappedBy="relojBase")
  856.      */
  857.     private $relojesDerivadosValoracionSinStock;
  858.     /**
  859.      * @ORM\OneToMany(targetEntity=\App\Entity\Reloj::class, mappedBy="relojBase")
  860.      */
  861.     private $relojesDerivados;
  862.     /**
  863.      * @ORM\ManyToOne(targetEntity="App\Entity\EstadoReloj", inversedBy="relojes")
  864.      * @ORM\JoinColumn(name="estado_reloj_id", referencedColumnName="id", nullable=true)
  865.      * @JMS\Type(EstadoReloj::class)
  866.      * @JMS\Groups({
  867.      *     "api_v1_reloj_serialize",
  868.      *     "api_v1_valoracion_serialize"
  869.      * })
  870.      */
  871.     protected $estado;
  872.     /**
  873.      * @ORM\ManyToOne(targetEntity="App\Entity\Marca", inversedBy="relojes")
  874.      * @ORM\JoinColumn(name="marca_id", referencedColumnName="id")
  875.      * @JMS\Type(Marca::class)
  876.      * @JMS\Groups({
  877.      *     "api_v1_reloj_serialize",
  878.      *     "api_v1_valoracion_serialize",
  879.      *     "api_v1_operacion_show_serialize",
  880.      *     "api_v1_promocion_serialize"
  881.      * })
  882.      */
  883.     protected $marca;
  884.     /**
  885.      * @ORM\ManyToOne(targetEntity="App\Entity\EstadoAspecto", inversedBy="relojes")
  886.      * @ORM\JoinColumn(name="estado_aspecto_id", referencedColumnName="id")
  887.      * @JMS\Type(EstadoAspecto::class)
  888.      * @JMS\Groups({
  889.      *     "api_v1_valoracion_serialize",
  890.      *     "api_v1_operacion_show_serialize",
  891.      *     "api_v1_promocion_serialize"
  892.      * })
  893.      */
  894.     protected $aspecto;
  895.     /**
  896.      * @ORM\ManyToOne(targetEntity="App\Entity\EstadoCheck", inversedBy="relojes")
  897.      * @ORM\JoinColumn(name="estado_check_id", referencedColumnName="id")
  898.      */
  899.     protected $check;
  900.     /**
  901.      * @ORM\JoinColumn(name="operacion_gestion_id", referencedColumnName="id")
  902.      * @ORM\ManyToOne(targetEntity=\App\Entity\Operacion::class, inversedBy="relojesGestion")
  903.      * @JMS\Groups({
  904.      *       "api_v1_reloj_serialize"
  905.      *   })
  906.      */
  907.     private $operacionGestion;
  908.     /**
  909.      * @ORM\JoinColumn(name="operacion_venta_id", referencedColumnName="id")
  910.      * @ORM\ManyToOne(targetEntity=\App\Entity\Operacion::class, inversedBy="relojesVenta")
  911.      * @JMS\Groups({
  912.      *       "api_v1_reloj_serialize"
  913.      *   })
  914.      */
  915.     private $operacionVenta;
  916.     /**
  917.      * @ORM\JoinColumn(name="operacion_compra_id", referencedColumnName="id")
  918.      * @ORM\ManyToOne(targetEntity=\App\Entity\Operacion::class, inversedBy="relojesCompra")
  919.      * @JMS\Groups({
  920.      *       "api_v1_reloj_serialize"
  921.      *   })
  922.      */
  923.     private $operacionCompra;
  924.     /**
  925.      * @ORM\ManyToOne(targetEntity=\App\Entity\Valoracion::class, inversedBy="relojes")
  926.      * @ORM\JoinColumn(name="valoracion_id", referencedColumnName="id")
  927.      */
  928.     private $valoracion;
  929.     /**
  930.      * @ORM\ManyToOne(targetEntity=\App\Entity\Empresa::class, inversedBy="relojes")
  931.      * @ORM\JoinColumn(name="empresa_id", referencedColumnName="id", nullable=false)
  932.      */
  933.     private $empresa;
  934.     /**
  935.      * @ORM\ManyToOne(targetEntity=\App\Entity\Material::class, inversedBy="relojesCajaRelojMaterial")
  936.      * @ORM\JoinColumn(name="caja_reloj_material_id", referencedColumnName="id")
  937.      */
  938.     private $cajaRelojMaterial;
  939.     /**
  940.      * @ORM\ManyToOne(targetEntity=\App\Entity\Material::class, inversedBy="relojesCajaRelojMaterialBisel")
  941.      * @ORM\JoinColumn(name="caja_reloj_bisel_material_id", referencedColumnName="id")
  942.      */
  943.     private $cajaRelojMaterialBisel;
  944.     /**
  945.      * @ORM\ManyToOne(targetEntity=\App\Entity\Material::class, inversedBy="relojesPulseraMaterial")
  946.      * @ORM\JoinColumn(name="pulsera_material_id", referencedColumnName="id")
  947.      */
  948.     private $pulseraMaterial;
  949.     /**
  950.      * @ORM\ManyToOne(targetEntity=\App\Entity\Material::class, inversedBy="relojesPulseraMaterialCierre")
  951.      * @ORM\JoinColumn(name="pulsera_material_cierre_id", referencedColumnName="id")
  952.      */
  953.     private $pulseraMaterialCierre;
  954.     /**
  955.      * @ORM\ManyToOne(targetEntity=\App\Entity\Reloj::class, inversedBy="relojesDerivados")
  956.      * @ORM\JoinColumn(name="reloj_base_id", referencedColumnName="id")
  957.      */
  958.     private $relojBase;
  959.     /**
  960.      * @ORM\OneToOne(targetEntity=\App\Entity\ActividadCompra::class, mappedBy="reloj")
  961.      * @JMS\Groups({
  962.      *       "api_v1_reloj_serialize"
  963.      *   })
  964.      */
  965.     private $actividadCompra;
  966.     /**
  967.      * @ORM\OneToOne(targetEntity=\App\Entity\ActividadVenta::class, mappedBy="reloj")
  968.      * @JMS\Groups({
  969.      *      "api_v1_reloj_serialize"
  970.      *  })
  971.      */
  972.     private $actividadVenta;
  973.     private $fechaStr;
  974.     public function __construct()
  975.     {
  976.         $this->reservado = false;
  977.         $this->papeles = false;
  978.         $this->caja = false;
  979.         $this->stock = false;
  980.         $this->custodia = false;
  981.         $this->gastos = new ArrayCollection();
  982.         $this->trazas = new ArrayCollection();
  983.         $this->valoracionesRelojes = new ArrayCollection();
  984.         $this->detalleVenta = new ArrayCollection();
  985.         $this->detalleCompra = new ArrayCollection();
  986.         $this->relojesDerivadosDetalleCompra = new ArrayCollection();
  987.         $this->relojesDerivadosValoracionSinStock = new ArrayCollection();
  988.         $this->relojesDerivados = new ArrayCollection();
  989.     }
  990.     public function __toString(): string
  991.     {
  992.         return (string)($this->getCodigo() ?? $this->getIDperseo());
  993.     }
  994.     public function getId(): ?int
  995.     {
  996.         return $this->id;
  997.     }
  998.     public function getIDperseo(): ?string
  999.     {
  1000.         return $this->IDperseo;
  1001.     }
  1002.     public function setIDperseo(string $IDperseo): self
  1003.     {
  1004.         $this->IDperseo = $IDperseo;
  1005.         return $this;
  1006.     }
  1007.     public function getRegimen(): ?string
  1008.     {
  1009.         return $this->regimen;
  1010.     }
  1011.     public function setRegimen(?string $regimen): self
  1012.     {
  1013.         $this->regimen = $regimen;
  1014.         return $this;
  1015.     }
  1016.     public function getFoto(): ?string
  1017.     {
  1018.         return $this->foto;
  1019.     }
  1020.     public function setFoto(?string $foto): self
  1021.     {
  1022.         $this->foto = $foto;
  1023.         return $this;
  1024.     }
  1025.     public function getFotoFile(): ?File
  1026.     {
  1027.         return $this->fotoFile;
  1028.     }
  1029.     public function setFotoFile(?File $fotoFile): self
  1030.     {
  1031.         $this->fotoFile = $fotoFile;
  1032.         if ($fotoFile) {
  1033.             // if 'updatedAt' is not defined in your entity, use another property
  1034.             $this->setUpdatedAt(new DateTime('now'));
  1035.         }
  1036.         return $this;
  1037.     }
  1038.     public function getModelo1(): ?string
  1039.     {
  1040.         return $this->modelo1;
  1041.     }
  1042.     public function setModelo1(?string $modelo1): self
  1043.     {
  1044.         $this->modelo1 = $modelo1;
  1045.         return $this;
  1046.     }
  1047.     public function getModelo2(): ?string
  1048.     {
  1049.         return $this->modelo2;
  1050.     }
  1051.     public function setModelo2(?string $modelo2): self
  1052.     {
  1053.         $this->modelo2 = $modelo2;
  1054.         return $this;
  1055.     }
  1056.     public function getRef1(): ?string
  1057.     {
  1058.         return $this->ref1;
  1059.     }
  1060.     public function setRef1(?string $ref1): self
  1061.     {
  1062.         $this->ref1 = $ref1;
  1063.         return $this;
  1064.     }
  1065.     public function getRef2(): ?string
  1066.     {
  1067.         return $this->ref2;
  1068.     }
  1069.     public function setRef2(?string $ref2): self
  1070.     {
  1071.         $this->ref2 = $ref2;
  1072.         return $this;
  1073.     }
  1074.     public function getSerie(): ?string
  1075.     {
  1076.         return $this->serie;
  1077.     }
  1078.     public function setSerie(?string $serie): self
  1079.     {
  1080.         $this->serie = $serie;
  1081.         return $this;
  1082.     }
  1083.     public function getFecha(): ?DateTimeInterface
  1084.     {
  1085.         return $this->fecha;
  1086.     }
  1087.     public function setFecha(?DateTimeInterface $fecha): self
  1088.     {
  1089.         $this->fecha = $fecha;
  1090.         return $this;
  1091.     }
  1092.     public function isCaja(): ?bool
  1093.     {
  1094.         return $this->caja;
  1095.     }
  1096.     public function getCaja(): ?bool
  1097.     {
  1098.         return $this->caja;
  1099.     }
  1100.     public function setCaja(bool $caja): self
  1101.     {
  1102.         $this->caja = $caja;
  1103.         return $this;
  1104.     }
  1105.     public function isPapeles(): ?bool
  1106.     {
  1107.         return $this->papeles;
  1108.     }
  1109.     public function getPapeles(): ?bool
  1110.     {
  1111.         return $this->papeles;
  1112.     }
  1113.     public function setPapeles(bool $papeles): self
  1114.     {
  1115.         $this->papeles = $papeles;
  1116.         return $this;
  1117.     }
  1118.     public function getOtros(): ?string
  1119.     {
  1120.         return $this->otros;
  1121.     }
  1122.     public function setOtros(?string $otros): self
  1123.     {
  1124.         $this->otros = $otros;
  1125.         return $this;
  1126.     }
  1127.     public function getITP(): ?float
  1128.     {
  1129.         return $this->ITP;
  1130.     }
  1131.     public function setITP(?float $ITP): self
  1132.     {
  1133.         $this->ITP = $ITP;
  1134.         return $this;
  1135.     }
  1136.     public function getComision(): ?float
  1137.     {
  1138.         return $this->comision;
  1139.     }
  1140.     public function setComision(?float $comision): self
  1141.     {
  1142.         $this->comision = $comision;
  1143.         return $this;
  1144.     }
  1145.     public function getPrecioCoste(): ?float
  1146.     {
  1147.         return $this->precioCoste;
  1148.     }
  1149.     public function setPrecioCoste(?float $precioCoste): self
  1150.     {
  1151.         $this->precioCoste = $precioCoste;
  1152.         return $this;
  1153.     }
  1154.     public function getPrecioCosteTotal(): ?float
  1155.     {
  1156.         return $this->precioCosteTotal;
  1157.     }
  1158.     public function setPrecioCosteTotal(?float $precioCosteTotal): self
  1159.     {
  1160.         $this->precioCosteTotal = $precioCosteTotal;
  1161.         return $this;
  1162.     }
  1163.     public function getPrecioMinVenta(): ?float
  1164.     {
  1165.         return $this->precioMinVenta;
  1166.     }
  1167.     public function setPrecioMinVenta(?float $precioMinVenta): self
  1168.     {
  1169.         $this->precioMinVenta = $precioMinVenta;
  1170.         return $this;
  1171.     }
  1172.     public function getPrecioPromocion(): ?float
  1173.     {
  1174.         return $this->precioPromocion;
  1175.     }
  1176.     public function setPrecioPromocion(?float $precioPromocion): self
  1177.     {
  1178.         $this->precioPromocion = $precioPromocion;
  1179.         return $this;
  1180.     }
  1181.     public function getPrecioOferta(): ?float
  1182.     {
  1183.         return $this->precioOferta;
  1184.     }
  1185.     public function setPrecioOferta(?float $precioOferta): self
  1186.     {
  1187.         $this->precioOferta = $precioOferta;
  1188.         return $this;
  1189.     }
  1190.     public function getPrecioPagar(): ?float
  1191.     {
  1192.         return $this->precioPagar;
  1193.     }
  1194.     public function setPrecioPagar(?float $precioPagar): self
  1195.     {
  1196.         $this->precioPagar = $precioPagar;
  1197.         return $this;
  1198.     }
  1199.     public function getPrecioVenta(): ?float
  1200.     {
  1201.         return $this->precioVenta;
  1202.     }
  1203.     public function setPrecioVenta(?float $precioVenta): self
  1204.     {
  1205.         $this->precioVenta = $precioVenta;
  1206.         return $this;
  1207.     }
  1208.     public function getPrecioVentaTotal(): ?float
  1209.     {
  1210.         return $this->precioVentaTotal;
  1211.     }
  1212.     public function setPrecioVentaTotal(?float $precioVentaTotal): self
  1213.     {
  1214.         $this->precioVentaTotal = $precioVentaTotal;
  1215.         return $this;
  1216.     }
  1217.     public function getMargenMinimo(): ?float
  1218.     {
  1219.         return $this->margenMinimo;
  1220.     }
  1221.     public function setMargenMinimo(?float $margenMinimo): self
  1222.     {
  1223.         $this->margenMinimo = $margenMinimo;
  1224.         return $this;
  1225.     }
  1226.     public function getMargenDeseado(): ?float
  1227.     {
  1228.         return $this->margenDeseado;
  1229.     }
  1230.     public function setMargenDeseado(?float $margenDeseado): self
  1231.     {
  1232.         $this->margenDeseado = $margenDeseado;
  1233.         return $this;
  1234.     }
  1235.     public function getMargenPromocion(): ?float
  1236.     {
  1237.         return $this->margenPromocion;
  1238.     }
  1239.     public function setMargenPromocion(?float $margenPromocion): self
  1240.     {
  1241.         $this->margenPromocion = $margenPromocion;
  1242.         return $this;
  1243.     }
  1244.     public function getMargenBruto(): ?float
  1245.     {
  1246.         return $this->margenBruto;
  1247.     }
  1248.     public function setMargenBruto(?float $margenBruto): self
  1249.     {
  1250.         $this->margenBruto = $margenBruto;
  1251.         return $this;
  1252.     }
  1253.     public function getStock(): ?bool
  1254.     {
  1255.         return $this->stock;
  1256.     }
  1257.     public function setStock(bool $stock): self
  1258.     {
  1259.         $this->stock = $stock;
  1260.         return $this;
  1261.     }
  1262.     public function getComentario(): ?string
  1263.     {
  1264.         return $this->comentario;
  1265.     }
  1266.     public function setComentario(?string $comentario): self
  1267.     {
  1268.         $this->comentario = $comentario;
  1269.         return $this;
  1270.     }
  1271.     public function getReservado(): ?bool
  1272.     {
  1273.         return $this->reservado;
  1274.     }
  1275.     public function setReservado(bool $reservado): self
  1276.     {
  1277.         $this->reservado = $reservado;
  1278.         return $this;
  1279.     }
  1280.     public function getTokenAccess(): ?string
  1281.     {
  1282.         return $this->tokenAccess;
  1283.     }
  1284.     public function setTokenAccess(?string $tokenAccess): self
  1285.     {
  1286.         $this->tokenAccess = $tokenAccess;
  1287.         return $this;
  1288.     }
  1289.     public function getTipoBloqueo(): ?string
  1290.     {
  1291.         return $this->tipoBloqueo;
  1292.     }
  1293.     public function setTipoBloqueo(?string $tipoBloqueo): self
  1294.     {
  1295.         $this->tipoBloqueo = $tipoBloqueo;
  1296.         return $this;
  1297.     }
  1298.     public function getExportacionStr():string
  1299.     {
  1300.         return $this->isExportacion() ? 'Exportacion' : 'Europa';
  1301.     }
  1302.     public function getExportacion(): ?bool
  1303.     {
  1304.         return $this->exportacion;
  1305.     }
  1306.     public function setExportacion(?bool $exportacion): self
  1307.     {
  1308.         $this->exportacion = $exportacion;
  1309.         return $this;
  1310.     }
  1311.     public function getDeletedAt(): ?DateTimeInterface
  1312.     {
  1313.         return $this->deletedAt;
  1314.     }
  1315.     public function setDeletedAt(?DateTimeInterface $deletedAt): self
  1316.     {
  1317.         $this->deletedAt = $deletedAt;
  1318.         return $this;
  1319.     }
  1320.     public function getUpdatedAt(): ?DateTimeInterface
  1321.     {
  1322.         return $this->updatedAt;
  1323.     }
  1324.     public function setUpdatedAt(DateTimeInterface $updatedAt): self
  1325.     {
  1326.         $this->updatedAt = $updatedAt;
  1327.         return $this;
  1328.     }
  1329.     public function getCreatedAt(): ?DateTimeInterface
  1330.     {
  1331.         return $this->createdAt;
  1332.     }
  1333.     public function setCreatedAt(DateTimeInterface $createdAt): self
  1334.     {
  1335.         $this->createdAt = $createdAt;
  1336.         return $this;
  1337.     }
  1338.     public function getRegistroPolicial(): ?RegistroPolicial
  1339.     {
  1340.         return $this->registroPolicial;
  1341.     }
  1342.     public function setRegistroPolicial(?RegistroPolicial $registroPolicial): self
  1343.     {
  1344.         // unset the owning side of the relation if necessary
  1345.         if ($registroPolicial === null && $this->registroPolicial !== null) {
  1346.             $this->registroPolicial->setReloj(null);
  1347.         }
  1348.         // set the owning side of the relation if necessary
  1349.         if ($registroPolicial !== null && $registroPolicial->getReloj() !== $this) {
  1350.             $registroPolicial->setReloj($this);
  1351.         }
  1352.         $this->registroPolicial = $registroPolicial;
  1353.         return $this;
  1354.     }
  1355.     /**
  1356.      * @return Collection|Gasto[]
  1357.      */
  1358.     public function getGastos(): Collection
  1359.     {
  1360.         return $this->gastos;
  1361.     }
  1362.     public function addGasto(Gasto $gasto): self
  1363.     {
  1364.         if (!$this->gastos->contains($gasto)) {
  1365.             $this->gastos[] = $gasto;
  1366.             $gasto->setReloj($this);
  1367.         }
  1368.         return $this;
  1369.     }
  1370.     public function removeGasto(Gasto $gasto): self
  1371.     {
  1372.         if ($this->gastos->removeElement($gasto)) {
  1373.             // set the owning side to null (unless already changed)
  1374.             if ($gasto->getReloj() === $this) {
  1375.                 $gasto->setReloj(null);
  1376.             }
  1377.         }
  1378.         return $this;
  1379.     }
  1380.     /**
  1381.      * @return Collection|Trazabilidad[]
  1382.      */
  1383.     public function getTrazas(): Collection
  1384.     {
  1385.         return $this->trazas;
  1386.     }
  1387.     public function addTraza(Trazabilidad $traza): self
  1388.     {
  1389.         if (!$this->trazas->contains($traza)) {
  1390.             $this->trazas[] = $traza;
  1391.             $traza->setReloj($this);
  1392.         }
  1393.         return $this;
  1394.     }
  1395.     public function removeTraza(Trazabilidad $traza): self
  1396.     {
  1397.         if ($this->trazas->removeElement($traza)) {
  1398.             // set the owning side to null (unless already changed)
  1399.             if ($traza->getReloj() === $this) {
  1400.                 $traza->setReloj(null);
  1401.             }
  1402.         }
  1403.         return $this;
  1404.     }
  1405.     public function getEstado(): ?EstadoReloj
  1406.     {
  1407.         return $this->estado;
  1408.     }
  1409.     public function setEstado(?EstadoReloj $estado): self
  1410.     {
  1411.         $this->estado = $estado;
  1412.         return $this;
  1413.     }
  1414.     public function getMarca(): ?Marca
  1415.     {
  1416.         return $this->marca;
  1417.     }
  1418.     public function setMarca(?Marca $marca): self
  1419.     {
  1420.         $this->marca = $marca;
  1421.         return $this;
  1422.     }
  1423.     /**
  1424.      * @return Collection|ValoracionesRelojes[]
  1425.      */
  1426.     public function getValoracionesRelojes(): Collection
  1427.     {
  1428.         return $this->valoracionesRelojes;
  1429.     }
  1430.     public function addValoracionesReloje(ValoracionesRelojes $valoracionesReloje): self
  1431.     {
  1432.         if (!$this->valoracionesRelojes->contains($valoracionesReloje)) {
  1433.             $this->valoracionesRelojes[] = $valoracionesReloje;
  1434.             $valoracionesReloje->setReloj($this);
  1435.         }
  1436.         return $this;
  1437.     }
  1438.     public function removeValoracionesReloje(ValoracionesRelojes $valoracionesReloje): self
  1439.     {
  1440.         if ($this->valoracionesRelojes->removeElement($valoracionesReloje)) {
  1441.             // set the owning side to null (unless already changed)
  1442.             if ($valoracionesReloje->getReloj() === $this) {
  1443.                 $valoracionesReloje->setReloj(null);
  1444.             }
  1445.         }
  1446.         return $this;
  1447.     }
  1448.     public function isStock(): ?bool
  1449.     {
  1450.         return $this->stock;
  1451.     }
  1452.     public function isReservado(): ?bool
  1453.     {
  1454.         return $this->reservado;
  1455.     }
  1456.     public function isExportacion(): ?bool
  1457.     {
  1458.         return $this->exportacion;
  1459.     }
  1460.     public function getFechaPromocion(): ?DateTimeInterface
  1461.     {
  1462.         return $this->fechaPromocion;
  1463.     }
  1464.     public function setFechaPromocion(?DateTimeInterface $fechaPromocion): self
  1465.     {
  1466.         $this->fechaPromocion = $fechaPromocion;
  1467.         return $this;
  1468.     }
  1469.     public function getFechaVenta(): ?DateTimeInterface
  1470.     {
  1471.         return $this->fechaVenta;
  1472.     }
  1473.     public function setFechaVenta(?DateTimeInterface $fechaVenta): self
  1474.     {
  1475.         $this->fechaVenta = $fechaVenta;
  1476.         return $this;
  1477.     }
  1478.     public function getFechaBaja(): ?DateTimeInterface
  1479.     {
  1480.         return $this->fechaBaja;
  1481.     }
  1482.     public function setFechaBaja(?DateTimeInterface $fechaBaja): self
  1483.     {
  1484.         $this->fechaBaja = $fechaBaja;
  1485.         return $this;
  1486.     }
  1487.     public function getMargenNeto(): ?float
  1488.     {
  1489.         return $this->margenNeto;
  1490.     }
  1491.     public function setMargenNeto(?float $margenNeto): self
  1492.     {
  1493.         $this->margenNeto = $margenNeto;
  1494.         return $this;
  1495.     }
  1496.     public function isCustodia(): ?bool
  1497.     {
  1498.         return $this->custodia;
  1499.     }
  1500.     public function setCustodia(bool $custodia): self
  1501.     {
  1502.         $this->custodia = $custodia;
  1503.         return $this;
  1504.     }
  1505.     public function getTiempoVenta(): ?float
  1506.     {
  1507.         return $this->tiempoVenta;
  1508.     }
  1509.     public function setTiempoVenta(?float $tiempoVenta): self
  1510.     {
  1511.         $this->tiempoVenta = $tiempoVenta;
  1512.         return $this;
  1513.     }
  1514.     public function isEnPromocion(): ?bool
  1515.     {
  1516.         return $this->enPromocion;
  1517.     }
  1518.     public function setEnPromocion(?bool $enPromocion): self
  1519.     {
  1520.         $this->enPromocion = $enPromocion;
  1521.         return $this;
  1522.     }
  1523.     public function isEnServicio(): ?bool
  1524.     {
  1525.         return $this->enServicio;
  1526.     }
  1527.     public function setEnServicio(?bool $enServicio): self
  1528.     {
  1529.         $this->enServicio = $enServicio;
  1530.         return $this;
  1531.     }
  1532.     public function isTipoBloqueo(): ?bool
  1533.     {
  1534.         return $this->tipoBloqueo;
  1535.     }
  1536.     public function getAspecto(): ?EstadoAspecto
  1537.     {
  1538.         return $this->aspecto;
  1539.     }
  1540.     public function setAspecto(?EstadoAspecto $aspecto): self
  1541.     {
  1542.         $this->aspecto = $aspecto;
  1543.         return $this;
  1544.     }
  1545.     public function getCheck(): ?EstadoCheck
  1546.     {
  1547.         return $this->check;
  1548.     }
  1549.     public function setCheck(?EstadoCheck $check): self
  1550.     {
  1551.         $this->check = $check;
  1552.         return $this;
  1553.     }
  1554.     public function isSinAnunciar(): ?bool
  1555.     {
  1556.         return $this->sinAnunciar;
  1557.     }
  1558.     public function setSinAnunciar(?bool $sinAnunciar): self
  1559.     {
  1560.         $this->sinAnunciar = $sinAnunciar;
  1561.         return $this;
  1562.     }
  1563.     public function isEnVenta(): ?bool
  1564.     {
  1565.         return $this->enVenta;
  1566.     }
  1567.     public function setEnVenta(?bool $enVenta): self
  1568.     {
  1569.         $this->enVenta = $enVenta;
  1570.         return $this;
  1571.     }
  1572.     public function getUrlImage():string
  1573.     {
  1574.         /* TODO cogerlo de la configuracion vich */
  1575.         return '/uploads/Reloj/'.$this->getId().'/'.$this->getFoto();
  1576.     }
  1577.     public function getFechaCompra(): ?DateTimeInterface
  1578.     {
  1579.         return $this->fechaCompra;
  1580.     }
  1581.     public function setFechaCompra(?DateTimeInterface $fechaCompra): static
  1582.     {
  1583.         $this->fechaCompra = $fechaCompra;
  1584.         return $this;
  1585.     }
  1586.     public function getPromociones(): ?Promocion
  1587.     {
  1588.         return $this->promociones;
  1589.     }
  1590.     public function setPromociones(?Promocion $promociones): static
  1591.     {
  1592.         // unset the owning side of the relation if necessary
  1593.         if ($promociones === null && $this->promociones !== null) {
  1594.             $this->promociones->setReloj(null);
  1595.         }
  1596.         // set the owning side of the relation if necessary
  1597.         if ($promociones !== null && $promociones->getReloj() !== $this) {
  1598.             $promociones->setReloj($this);
  1599.         }
  1600.         $this->promociones = $promociones;
  1601.         return $this;
  1602.     }
  1603.     public function getCodigo(): ?string
  1604.     {
  1605.         return $this->codigo;
  1606.     }
  1607.     public function setCodigo(string $codigo): static
  1608.     {
  1609.         $this->codigo = $codigo;
  1610.         return $this;
  1611.     }
  1612.     /**
  1613.      * @JMS\VirtualProperty()
  1614.      * @JMS\SerializedName("modelos")
  1615.      * @JMS\Groups({
  1616.      *      "api_v1_promocion_serialize"
  1617.      *  })
  1618.      * @return string|null
  1619.      */
  1620.     public function getModelos(): ?string
  1621.     {
  1622.         return implode(' ', array_filter([$this->getModelo1(), $this->getModelo2()]));
  1623.     }
  1624.     /*public function setModelos(?string $modelos): static
  1625.     {
  1626.         $modelosArray = explode(',', $modelos);
  1627.         $this->setModelo1(@$modelosArray[0]);
  1628.         $this->setModelo2(@$modelosArray[1]);
  1629.         return $this;
  1630.     }*/
  1631.     /**
  1632.      * @JMS\VirtualProperty()
  1633.      * @JMS\SerializedName("refs")
  1634.      * @JMS\Groups({
  1635.      *      "api_v1_promocion_serialize"
  1636.      *  })
  1637.      * @return string|null
  1638.      */
  1639.     public function getRefs(): ?string
  1640.     {
  1641.         return implode('', array_filter([$this->getRef1(), $this->getRef2()]));
  1642.     }
  1643.     /*public function setRefs(?string $refs): static
  1644.     {
  1645.         $refsArray = explode(',', $refs);
  1646.         $this->setRef1(@$refsArray[0]);
  1647.         $this->setRef2(@$refsArray[1]);
  1648.         return $this;
  1649.     }*/
  1650.     public function getActividad(): ?ActividadAbstract
  1651.     {
  1652.         return $this->actividad;
  1653.     }
  1654.     public function setActividad(?ActividadAbstract $actividad): static
  1655.     {
  1656.         // unset the owning side of the relation if necessary
  1657.         if ($actividad === null && $this->actividad !== null) {
  1658.             $this->actividad->setReloj(null);
  1659.         }
  1660.         // set the owning side of the relation if necessary
  1661.         if ($actividad !== null && $actividad->getReloj() !== $this) {
  1662.             $actividad->setReloj($this);
  1663.         }
  1664.         $this->actividad = $actividad;
  1665.         return $this;
  1666.     }
  1667.     public function getFotoValoracion(): ?string
  1668.     {
  1669.         return $this->fotoValoracion;
  1670.     }
  1671.     public function setFotoValoracion(?string $fotoValoracion): static
  1672.     {
  1673.         $this->fotoValoracion = $fotoValoracion;
  1674.         return $this;
  1675.     }
  1676.     public function getFotoValoracionFile(): ?File
  1677.     {
  1678.         return $this->fotoValoracionFile;
  1679.     }
  1680.     public function setFotoValoracionFile(?File $fotoValoracionFile): self
  1681.     {
  1682.         $this->fotoValoracionFile = $fotoValoracionFile;
  1683.         if ($fotoValoracionFile) {
  1684.             // if 'updatedAt' is not defined in your entity, use another property
  1685.             $this->setUpdatedAt(new DateTime('now'));
  1686.         }
  1687.         return $this;
  1688.     }
  1689.     public function getFotoSet(): ?string
  1690.     {
  1691.         return $this->fotoSet;
  1692.     }
  1693.     public function setFotoSet(?string $fotoSet): static
  1694.     {
  1695.         $this->fotoSet = $fotoSet;
  1696.         return $this;
  1697.     }
  1698.     public function getFotoSetFile(): ?File
  1699.     {
  1700.         return $this->fotoSetFile;
  1701.     }
  1702.     public function setFotoSetFile(?File $fotoSetFile): self
  1703.     {
  1704.         $this->fotoSetFile = $fotoSetFile;
  1705.         if ($fotoSetFile) {
  1706.             // if 'updatedAt' is not defined in your entity, use another property
  1707.             $this->setUpdatedAt(new DateTime('now'));
  1708.         }
  1709.         return $this;
  1710.     }
  1711.     public function getFotoCrono(): ?string
  1712.     {
  1713.         return $this->fotoCrono;
  1714.     }
  1715.     public function setFotoCrono(?string $fotoCrono): static
  1716.     {
  1717.         $this->fotoCrono = $fotoCrono;
  1718.         return $this;
  1719.     }
  1720.     public function getFotoCronoFile(): ?File
  1721.     {
  1722.         return $this->fotoCronoFile;
  1723.     }
  1724.     public function setFotoCronoFile(?File $fotoCronoFile): self
  1725.     {
  1726.         $this->fotoCronoFile = $fotoCronoFile;
  1727.         if ($fotoCronoFile) {
  1728.             // if 'updatedAt' is not defined in your entity, use another property
  1729.             $this->setUpdatedAt(new DateTime('now'));
  1730.         }
  1731.         return $this;
  1732.     }
  1733.     public function getVideo(): ?string
  1734.     {
  1735.         return $this->video;
  1736.     }
  1737.     public function setVideo(?string $video): static
  1738.     {
  1739.         $this->video = $video;
  1740.         return $this;
  1741.     }
  1742.     public function getVideoFile(): ?File
  1743.     {
  1744.         return $this->videoFile;
  1745.     }
  1746.     public function setVideoFile(?File $videoFile): self
  1747.     {
  1748.         $this->videoFile = $videoFile;
  1749.         if ($videoFile) {
  1750.             // if 'updatedAt' is not defined in your entity, use another property
  1751.             $this->setUpdatedAt(new DateTime('now'));
  1752.         }
  1753.         return $this;
  1754.     }
  1755.     /**
  1756.      * @return bool|null
  1757.      * @deprecated Por cambios de funcionalidad
  1758.      */
  1759.     public function isChrono24(): ?bool
  1760.     {
  1761.         return $this->chrono24;
  1762.     }
  1763.     /**
  1764.      * @deprecated Por cambios de funcionalidad
  1765.      * @param bool|null $chrono24
  1766.      * @return $this
  1767.      */
  1768.     public function setChrono24(?bool $chrono24): static
  1769.     {
  1770.         $this->chrono24 = $chrono24;
  1771.         return $this;
  1772.     }
  1773.     /**
  1774.      * @return Collection<int, DetalleVenta>
  1775.      */
  1776.     public function getDetalleVenta(): Collection
  1777.     {
  1778.         return $this->detalleVenta;
  1779.     }
  1780.     public function getDetalleVentaAsentada(): ?DetalleVenta
  1781.     {
  1782.         return ($this->getDetalleVenta()->filter(fn($dc) => $dc->getVenta()->getOperacion()->getEstado()->getKey() === EstadoOperacionEnum::ESTADO_ASENTADA))->first();
  1783.     }
  1784.     public function addDetalleVentum(DetalleVenta $detalleVentum): static
  1785.     {
  1786.         if (!$this->detalleVenta->contains($detalleVentum)) {
  1787.             $this->detalleVenta->add($detalleVentum);
  1788.             $detalleVentum->setReloj($this);
  1789.         }
  1790.         return $this;
  1791.     }
  1792.     public function removeDetalleVentum(DetalleVenta $detalleVentum): static
  1793.     {
  1794.         if ($this->detalleVenta->removeElement($detalleVentum)) {
  1795.             // set the owning side to null (unless already changed)
  1796.             if ($detalleVentum->getReloj() === $this) {
  1797.                 $detalleVentum->setReloj(null);
  1798.             }
  1799.         }
  1800.         return $this;
  1801.     }
  1802.     public function getPrecioCompra(): ?float
  1803.     {
  1804.         return $this->precioCompra;
  1805.     }
  1806.     public function setPrecioCompra(?float $precioCompra): static
  1807.     {
  1808.         $this->precioCompra = $precioCompra;
  1809.         return $this;
  1810.     }
  1811.     /**
  1812.      * @deprecated A partir del 04/06/2024 cuando se realiza el ciclo completo sustituir por "getOperacionCompra"
  1813.      * @return Operacion|null
  1814.      */
  1815.     public function getOperacion():?Operacion
  1816.     {
  1817.         return $this->getDetalleCompra()?->getCompra()?->getOperacion();
  1818.     }
  1819.     public function getOperacionCompra():?Operacion
  1820.     {
  1821.         //return $this->getDetalleCompra()?->getCompra()?->getOperacion()->filter(fn($operacion) => $operacion->getEstado()?->getKey() === EstadoOperacionEnum::ESTADO_CONFIRMADA || $operacion->getEstado()?->getKey() === EstadoOperacionEnum::ESTADO_ASENTADA);
  1822.         return $this->operacionCompra;
  1823.     }
  1824.     public function getOperacionGestionCompra():?Operacion
  1825.     {
  1826.         return $this->getOperacionCompra()??$this->getOperacionGestion();
  1827.     }
  1828.     public function getOperacionVenta():?Operacion
  1829.     {
  1830.         /*$detalle = $this->getDetalleVenta();
  1831.         if($detalle->count() !== 1 && $detalle->count() !== 0) throw new Exception('ERROR, PENDIENTE de resolver / controlar');
  1832.         return $detalle->count() === 0 ? null : $this->getDetalleVenta()->first()->getVenta()?->getOperacion();*/
  1833.         try {
  1834.             if ($this->operacionVenta?->getDeletedAt() === null) return $this->operacionVenta;
  1835.         }
  1836.         catch(EntityNotFoundException $e)
  1837.         {
  1838.             return null;
  1839.         }
  1840.         return $this->operacionVenta;
  1841.     }
  1842.     public function getRecompra(): ?float
  1843.     {
  1844.         return $this->recompra;
  1845.     }
  1846.     public function setRecompra(?float $recompra): static
  1847.     {
  1848.         $this->recompra = $recompra;
  1849.         return $this;
  1850.     }
  1851.     public function getGarantia(): ?string
  1852.     {
  1853.         return $this->garantia;
  1854.     }
  1855.     public function setGarantia(?string $garantia): static
  1856.     {
  1857.         $this->garantia = $garantia;
  1858.         return $this;
  1859.     }
  1860.     public function getOperacionGestion(): ?Operacion
  1861.     {
  1862.         return $this->operacionGestion;
  1863.     }
  1864.     public function setOperacionGestion(?Operacion $operacionGestion): static
  1865.     {
  1866.         $this->operacionGestion = $operacionGestion;
  1867.         return $this;
  1868.     }
  1869.     public function setOperacionVenta(?Operacion $operacionVenta): static
  1870.     {
  1871.         $this->operacionVenta = $operacionVenta;
  1872.         return $this;
  1873.     }
  1874.     public function setOperacionCompra(?Operacion $operacionCompra): static
  1875.     {
  1876.         $this->operacionCompra = $operacionCompra;
  1877.         return $this;
  1878.     }
  1879.     public function getActividadCompra(): ?ActividadCompra
  1880.     {
  1881.         return $this->actividadCompra;
  1882.     }
  1883.     public function setActividadCompra(?ActividadCompra $actividadCompra): static
  1884.     {
  1885.         // unset the owning side of the relation if necessary
  1886.         if ($actividadCompra === null && $this->actividadCompra !== null) {
  1887.             $this->actividadCompra->setReloj(null);
  1888.         }
  1889.         // set the owning side of the relation if necessary
  1890.         if ($actividadCompra !== null && $actividadCompra->getReloj() !== $this) {
  1891.             $actividadCompra->setReloj($this);
  1892.         }
  1893.         $this->actividadCompra = $actividadCompra;
  1894.         return $this;
  1895.     }
  1896.     public function getActividadVenta(): ?ActividadVenta
  1897.     {
  1898.         return $this->actividadVenta;
  1899.     }
  1900.     public function setActividadVenta(?ActividadVenta $actividadVenta): static
  1901.     {
  1902.         // unset the owning side of the relation if necessary
  1903.         if ($actividadVenta === null && $this->actividadVenta !== null) {
  1904.             $this->actividadVenta->setReloj(null);
  1905.         }
  1906.         // set the owning side of the relation if necessary
  1907.         if ($actividadVenta !== null && $actividadVenta->getReloj() !== $this) {
  1908.             $actividadVenta->setReloj($this);
  1909.         }
  1910.         $this->actividadVenta = $actividadVenta;
  1911.         return $this;
  1912.     }
  1913.     public function getPeso(): ?float
  1914.     {
  1915.         return $this->peso;
  1916.     }
  1917.     public function setPeso(?float $peso): static
  1918.     {
  1919.         $this->peso = $peso;
  1920.         return $this;
  1921.     }
  1922.     public function getDescripcion(): ?string
  1923.     {
  1924.         return $this->descripcion;
  1925.     }
  1926.     public function setDescripcion(?string $descripcion): static
  1927.     {
  1928.         $this->descripcion = $descripcion;
  1929.         return $this;
  1930.     }
  1931.     public function getFechaStr(): ?string
  1932.     {
  1933.         return $this->fecha?->format("d/m/Y");
  1934.     }
  1935.     public function getExportPeso():?string
  1936.     {
  1937.         return number_format($this->peso, 2, ',', '.') . ' g.';
  1938.     }
  1939.     public function getExportPrecioCompra():?string
  1940.     {
  1941.         return number_format($this->precioCompra, 2, ',', '.') . ' €';
  1942.     }
  1943.     /**
  1944.      * @return Collection<int, DetalleCompra>
  1945.      */
  1946.     public function getDetalleCompra(): Collection
  1947.     {
  1948.         return $this->detalleCompra;
  1949.     }
  1950.     public function getDetalleCompraAsentada(): ?DetalleCompra
  1951.     {
  1952.         return ($this->getDetalleCompra()->filter(fn($dc) => $dc->getCompra()->getOperacion()->getTipo() === TipoOperacionEnum::OPERACION_COMPRA || $dc->getCompra()->getOperacion()->getTipo() === TipoOperacionEnum::OPERACION_PERMUTA))->first();
  1953.     }
  1954.     public function addDetalleCompra(DetalleCompra $detalleCompra): static
  1955.     {
  1956.         if (!$this->detalleCompra->contains($detalleCompra)) {
  1957.             $this->detalleCompra->add($detalleCompra);
  1958.             $detalleCompra->setReloj($this);
  1959.         }
  1960.         return $this;
  1961.     }
  1962.     public function removeDetalleCompra(DetalleCompra $detalleCompra): static
  1963.     {
  1964.         if ($this->detalleCompra->removeElement($detalleCompra)) {
  1965.             // set the owning side to null (unless already changed)
  1966.             if ($detalleCompra->getReloj() === $this) {
  1967.                 $detalleCompra->setReloj(null);
  1968.             }
  1969.         }
  1970.         return $this;
  1971.     }
  1972.     public function getTiempoEnVenta(): ?int
  1973.     {
  1974.         $this->updateDerivedTimes();
  1975.         return $this->tiempoEnVenta;
  1976.     }
  1977.     public function setTiempoEnVenta(?int $tiempoEnVenta): static
  1978.     {
  1979.         $this->tiempoEnVenta = $tiempoEnVenta;
  1980.         return $this;
  1981.     }
  1982.     public function getTiempoEnStock(): ?int
  1983.     {
  1984.         return $this->tiempoEnStock;
  1985.     }
  1986.     public function setTiempoEnStock(?int $tiempoEnStock): static
  1987.     {
  1988.         $this->tiempoEnStock = $tiempoEnStock;
  1989.         return $this;
  1990.     }
  1991.     public function getFechaRecepcion(): ?DateTimeInterface
  1992.     {
  1993.         return $this->fechaRecepcion;
  1994.     }
  1995.     public function getFechaRecepcionStr(): ?string
  1996.     {
  1997.         return $this->fechaRecepcion?->format("d/m/Y");
  1998.     }
  1999.     public function setFechaRecepcion(?DateTimeInterface $fechaRecepcion): static
  2000.     {
  2001.         $this->fechaRecepcion = $fechaRecepcion;
  2002.         return $this;
  2003.     }
  2004.     public function getFechaValoracion(): ?DateTimeInterface
  2005.     {
  2006.         return $this->fechaValoracion;
  2007.     }
  2008.     public function setFechaValoracion(?DateTimeInterface $fechaValoracion): static
  2009.     {
  2010.         $this->fechaValoracion = $fechaValoracion;
  2011.         return $this;
  2012.     }
  2013.     public function getFechaAnuncio(): ?DateTimeInterface
  2014.     {
  2015.         return $this->fechaAnuncio;
  2016.     }
  2017.     public function setFechaAnuncio(?DateTimeInterface $fechaAnuncio): static
  2018.     {
  2019.         $this->fechaAnuncio = $fechaAnuncio;
  2020.         return $this;
  2021.     }
  2022.     public function getValoracion(): ?Valoracion
  2023.     {
  2024.         return $this->valoracion;
  2025.     }
  2026.     public function setValoracion(?Valoracion $valoracion): static
  2027.     {
  2028.         $this->valoracion = $valoracion;
  2029.         return $this;
  2030.     }
  2031.     public function getValoracionReloj(): ?ValoracionesRelojesSinStock
  2032.     {
  2033.         return $this->valoracionReloj;
  2034.     }
  2035.     public function setValoracionReloj(?ValoracionesRelojesSinStock $valoracionReloj): static
  2036.     {
  2037.         // unset the owning side of the relation if necessary
  2038.         if ($valoracionReloj === null && $this->valoracionReloj !== null) {
  2039.             $this->valoracionReloj->setRelojInventario(null);
  2040.         }
  2041.         // set the owning side of the relation if necessary
  2042.         if ($valoracionReloj !== null && $valoracionReloj->getRelojInventario() !== $this) {
  2043.             $valoracionReloj->setRelojInventario($this);
  2044.         }
  2045.         $this->valoracionReloj = $valoracionReloj;
  2046.         return $this;
  2047.     }
  2048.     public function hasBeenSold():bool
  2049.     {
  2050.         if($this->getEstado()?->getKey() === EstadoRelojEnum::ESTADO_VENDIDO) return true;
  2051.         if($this->getFechaVenta()) return true;
  2052.         $criteria = Criteria::create()
  2053.             ->orderBy(['fecha' => Criteria::DESC])
  2054.             ->setMaxResults(1);
  2055.         $ultimaAccion = $this->getPromociones()?->getAcciones()
  2056.             ?->filter(fn($accion) => $accion instanceof AccionEstado)
  2057.             ?->matching($criteria)
  2058.             ?->first();
  2059.         return $ultimaAccion?->getEstado()?->getKey() === EstadoRelojEnum::ESTADO_VENDIDO;
  2060.     }
  2061.     public function hasBeenBought():bool
  2062.     {
  2063.         if($this->getEstado()?->getKey() === EstadoRelojEnum::ESTADO_COMPRA) return true;
  2064.         if($this->getFechaCompra()) return true;
  2065.         $criteria = Criteria::create()
  2066.             ->orderBy(['fecha' => Criteria::DESC])
  2067.             ->setMaxResults(1);
  2068.         $ultimaAccion = $this->getPromociones()?->getAcciones()
  2069.             ?->filter(fn($accion) => $accion instanceof AccionEstado)
  2070.             ?->matching($criteria)
  2071.             ?->first();
  2072.         return $ultimaAccion?->getEstado()?->getKey() === EstadoRelojEnum::ESTADO_COMPRA;
  2073.     }
  2074.     public function getGenero(): ?GeneroRelojEnum
  2075.     {
  2076.         return $this->genero;
  2077.     }
  2078.     public function setGenero(?GeneroRelojEnum $genero): static
  2079.     {
  2080.         $this->genero = $genero;
  2081.         return $this;
  2082.     }
  2083.     public function getEstadoCaja(): ?int
  2084.     {
  2085.         return $this->estadoCaja;
  2086.     }
  2087.     public function setEstadoCaja(?int $estadoCaja): static
  2088.     {
  2089.         $this->estadoCaja = $estadoCaja;
  2090.         return $this;
  2091.     }
  2092.     public function getEstadoCristal(): ?int
  2093.     {
  2094.         return $this->estadoCristal;
  2095.     }
  2096.     public function setEstadoCristal(?int $estadoCristal): static
  2097.     {
  2098.         $this->estadoCristal = $estadoCristal;
  2099.         return $this;
  2100.     }
  2101.     public function getEstadoDial(): ?int
  2102.     {
  2103.         return $this->estadoDial;
  2104.     }
  2105.     public function setEstadoDial(?int $estadoDial): static
  2106.     {
  2107.         $this->estadoDial = $estadoDial;
  2108.         return $this;
  2109.     }
  2110.     public function getEstadoAgujas(): ?int
  2111.     {
  2112.         return $this->estadoAgujas;
  2113.     }
  2114.     public function setEstadoAgujas(?int $estadoAgujas): static
  2115.     {
  2116.         $this->estadoAgujas = $estadoAgujas;
  2117.         return $this;
  2118.     }
  2119.     public function getEstadoTapa(): ?int
  2120.     {
  2121.         return $this->estadoTapa;
  2122.     }
  2123.     public function setEstadoTapa(?int $estadoTapa): static
  2124.     {
  2125.         $this->estadoTapa = $estadoTapa;
  2126.         return $this;
  2127.     }
  2128.     public function getEstadoCorrea(): ?int
  2129.     {
  2130.         return $this->estadoCorrea;
  2131.     }
  2132.     public function setEstadoCorrea(?int $estadoCorrea): static
  2133.     {
  2134.         $this->estadoCorrea = $estadoCorrea;
  2135.         return $this;
  2136.     }
  2137.     public function getEsferaIndice(): ?TipoEsferaIndiceEnum
  2138.     {
  2139.         return $this->esferaIndice;
  2140.     }
  2141.     public function setEsferaIndice(?TipoEsferaIndiceEnum $esferaIndice): static
  2142.     {
  2143.         $this->esferaIndice = $esferaIndice;
  2144.         return $this;
  2145.     }
  2146.     public function getEsferaColor(): ?string
  2147.     {
  2148.         return $this->esferaColor;
  2149.     }
  2150.     public function setEsferaColor(?string $esferaColor): static
  2151.     {
  2152.         $this->esferaColor = $esferaColor;
  2153.         return $this;
  2154.     }
  2155.     public function isEsferaJoyas(): ?bool
  2156.     {
  2157.         return $this->esferaJoyas;
  2158.     }
  2159.     public function setEsferaJoyas(?bool $esferaJoyas): static
  2160.     {
  2161.         $this->esferaJoyas = $esferaJoyas;
  2162.         return $this;
  2163.     }
  2164.     public function getCajaRelojDiametro(): ?int
  2165.     {
  2166.         return $this->cajaRelojDiametro;
  2167.     }
  2168.     public function setCajaRelojDiametro(?int $cajaRelojDiametro): static
  2169.     {
  2170.         $this->cajaRelojDiametro = $cajaRelojDiametro;
  2171.         return $this;
  2172.     }
  2173.     public function getCajaRelojGrosor(): ?int
  2174.     {
  2175.         return $this->cajaRelojGrosor;
  2176.     }
  2177.     public function setCajaRelojGrosor(?int $cajaRelojGrosor): static
  2178.     {
  2179.         $this->cajaRelojGrosor = $cajaRelojGrosor;
  2180.         return $this;
  2181.     }
  2182.     public function getCajaRelojResistenciaAgua(): ?int
  2183.     {
  2184.         return $this->cajaRelojResistenciaAgua;
  2185.     }
  2186.     public function setCajaRelojResistenciaAgua(?int $cajaRelojResistenciaAgua): static
  2187.     {
  2188.         $this->cajaRelojResistenciaAgua = $cajaRelojResistenciaAgua;
  2189.         return $this;
  2190.     }
  2191.     public function getCajaRelojCristal(): ?TipoCristalEnum
  2192.     {
  2193.         return $this->cajaRelojCristal;
  2194.     }
  2195.     public function setCajaRelojCristal(?TipoCristalEnum $cajaRelojCristal): static
  2196.     {
  2197.         $this->cajaRelojCristal = $cajaRelojCristal;
  2198.         return $this;
  2199.     }
  2200.     public function getPulseraColor(): ?string
  2201.     {
  2202.         return $this->pulseraColor;
  2203.     }
  2204.     public function setPulseraColor(?string $pulseraColor): static
  2205.     {
  2206.         $this->pulseraColor = $pulseraColor;
  2207.         return $this;
  2208.     }
  2209.     public function getPulseraCierre(): ?TipoCierreEnum
  2210.     {
  2211.         return $this->pulseraCierre;
  2212.     }
  2213.     public function setPulseraCierre(?TipoCierreEnum $pulseraCierre): static
  2214.     {
  2215.         $this->pulseraCierre = $pulseraCierre;
  2216.         return $this;
  2217.     }
  2218.     public function getPulseraAnchoCaja(): ?int
  2219.     {
  2220.         return $this->pulseraAnchoCaja;
  2221.     }
  2222.     public function setPulseraAnchoCaja(?int $pulseraAnchoCaja): static
  2223.     {
  2224.         $this->pulseraAnchoCaja = $pulseraAnchoCaja;
  2225.         return $this;
  2226.     }
  2227.     public function getPulseraAnchoCierre(): ?int
  2228.     {
  2229.         return $this->pulseraAnchoCierre;
  2230.     }
  2231.     public function setPulseraAnchoCierre(?int $pulseraAnchoCierre): static
  2232.     {
  2233.         $this->pulseraAnchoCierre = $pulseraAnchoCierre;
  2234.         return $this;
  2235.     }
  2236.     public function getPulseraMedidaMunieca(): ?int
  2237.     {
  2238.         return $this->pulseraMedidaMunieca;
  2239.     }
  2240.     public function setPulseraMedidaMunieca(?int $pulseraMedidaMunieca): static
  2241.     {
  2242.         $this->pulseraMedidaMunieca = $pulseraMedidaMunieca;
  2243.         return $this;
  2244.     }
  2245.     public function getCalibre(): ?CalibreEnum
  2246.     {
  2247.         return $this->calibre;
  2248.     }
  2249.     public function setCalibre(?CalibreEnum $calibre): static
  2250.     {
  2251.         $this->calibre = $calibre;
  2252.         return $this;
  2253.     }
  2254.     public function getCalibreAvanzado(): ?string
  2255.     {
  2256.         return $this->calibreAvanzado;
  2257.     }
  2258.     public function setCalibreAvanzado(?string $calibreAvanzado): static
  2259.     {
  2260.         $this->calibreAvanzado = $calibreAvanzado;
  2261.         return $this;
  2262.     }
  2263.     public function getCalibreBasico(): ?string
  2264.     {
  2265.         return $this->calibreBasico;
  2266.     }
  2267.     public function setCalibreBasico(?string $calibreBasico): static
  2268.     {
  2269.         $this->calibreBasico = $calibreBasico;
  2270.         return $this;
  2271.     }
  2272.     public function getCalibreReservaMarcha(): ?string
  2273.     {
  2274.         return $this->calibreReservaMarcha;
  2275.     }
  2276.     public function setCalibreReservaMarcha(?string $calibreReservaMarcha): static
  2277.     {
  2278.         $this->calibreReservaMarcha = $calibreReservaMarcha;
  2279.         return $this;
  2280.     }
  2281.     public function getCalibreNumeroJoyas(): ?string
  2282.     {
  2283.         return $this->calibreNumeroJoyas;
  2284.     }
  2285.     public function setCalibreNumeroJoyas(?string $calibreNumeroJoyas): static
  2286.     {
  2287.         $this->calibreNumeroJoyas = $calibreNumeroJoyas;
  2288.         return $this;
  2289.     }
  2290.     public function getCalibreOscilacion(): ?string
  2291.     {
  2292.         return $this->calibreOscilacion;
  2293.     }
  2294.     public function setCalibreOscilacion(?string $calibreOscilacion): static
  2295.     {
  2296.         $this->calibreOscilacion = $calibreOscilacion;
  2297.         return $this;
  2298.     }
  2299.     public function getCalibreAmplitud(): ?string
  2300.     {
  2301.         return $this->calibreAmplitud;
  2302.     }
  2303.     public function setCalibreAmplitud(?string $calibreAmplitud): static
  2304.     {
  2305.         $this->calibreAmplitud = $calibreAmplitud;
  2306.         return $this;
  2307.     }
  2308.     public function getCalibreMarcha(): ?string
  2309.     {
  2310.         return $this->calibreMarcha;
  2311.     }
  2312.     public function setCalibreMarcha(?string $calibreMarcha): static
  2313.     {
  2314.         $this->calibreMarcha = $calibreMarcha;
  2315.         return $this;
  2316.     }
  2317.     public function getPiezasRepuesto(): ?PiezaRepuestoEnum
  2318.     {
  2319.         return $this->piezasRepuesto;
  2320.     }
  2321.     public function setPiezasRepuesto(?PiezaRepuestoEnum $piezasRepuesto): static
  2322.     {
  2323.         $this->piezasRepuesto = $piezasRepuesto;
  2324.         return $this;
  2325.     }
  2326.     public function getPiezasRepuestoObservaciones(): ?string
  2327.     {
  2328.         return $this->piezasRepuestoObservaciones;
  2329.     }
  2330.     public function setPiezasRepuestoObservaciones(?string $piezasRepuestoObservaciones): static
  2331.     {
  2332.         $this->piezasRepuestoObservaciones = $piezasRepuestoObservaciones;
  2333.         return $this;
  2334.     }
  2335.     public function getServicioMantenimiento(): ?ServicioMantenimientoEnum
  2336.     {
  2337.         return $this->servicioMantenimiento;
  2338.     }
  2339.     public function setServicioMantenimiento(?ServicioMantenimientoEnum $servicioMantenimiento): static
  2340.     {
  2341.         $this->servicioMantenimiento = $servicioMantenimiento;
  2342.         return $this;
  2343.     }
  2344.     public function getCondiciones(): ?string
  2345.     {
  2346.         return $this->condiciones;
  2347.     }
  2348.     public function setCondiciones(?string $condiciones): static
  2349.     {
  2350.         $this->condiciones = $condiciones;
  2351.         return $this;
  2352.     }
  2353.     public function getAnuncioES(): ?string
  2354.     {
  2355.         return $this->anuncioES;
  2356.     }
  2357.     public function setAnuncioES(?string $anuncioES): static
  2358.     {
  2359.         $this->anuncioES = $anuncioES;
  2360.         return $this;
  2361.     }
  2362.     public function getAnuncioEN(): ?string
  2363.     {
  2364.         return $this->anuncioEN;
  2365.     }
  2366.     public function setAnuncioEN(?string $anuncioEN): static
  2367.     {
  2368.         $this->anuncioEN = $anuncioEN;
  2369.         return $this;
  2370.     }
  2371.     public function getEmpresa(): ?Empresa
  2372.     {
  2373.         return $this->empresa;
  2374.     }
  2375.     public function setEmpresa(?Empresa $empresa): static
  2376.     {
  2377.         $this->empresa = $empresa;
  2378.         return $this;
  2379.     }
  2380.     public function getCajaRelojMaterial(): ?Material
  2381.     {
  2382.         return $this->cajaRelojMaterial;
  2383.     }
  2384.     public function setCajaRelojMaterial(?Material $cajaRelojMaterial): static
  2385.     {
  2386.         $this->cajaRelojMaterial = $cajaRelojMaterial;
  2387.         return $this;
  2388.     }
  2389.     public function getCajaRelojMaterialBisel(): ?Material
  2390.     {
  2391.         return $this->cajaRelojMaterialBisel;
  2392.     }
  2393.     public function setCajaRelojMaterialBisel(?Material $cajaRelojMaterialBisel): static
  2394.     {
  2395.         $this->cajaRelojMaterialBisel = $cajaRelojMaterialBisel;
  2396.         return $this;
  2397.     }
  2398.     public function getPulseraMaterial(): ?Material
  2399.     {
  2400.         return $this->pulseraMaterial;
  2401.     }
  2402.     public function setPulseraMaterial(?Material $pulseraMaterial): static
  2403.     {
  2404.         $this->pulseraMaterial = $pulseraMaterial;
  2405.         return $this;
  2406.     }
  2407.     public function getPulseraMaterialCierre(): ?Material
  2408.     {
  2409.         return $this->pulseraMaterialCierre;
  2410.     }
  2411.     public function setPulseraMaterialCierre(?Material $pulseraMaterialCierre): static
  2412.     {
  2413.         $this->pulseraMaterialCierre = $pulseraMaterialCierre;
  2414.         return $this;
  2415.     }
  2416.     public function getCalibreCaracteristicas(): ?array
  2417.     {
  2418.         return $this->calibreCaracteristicas;
  2419.     }
  2420.     public function setCalibreCaracteristicas(?array $calibreCaracteristicas): static
  2421.     {
  2422.         $this->calibreCaracteristicas = $calibreCaracteristicas;
  2423.         return $this;
  2424.     }
  2425.     public function getCalibreFunciones(): ?array
  2426.     {
  2427.         return $this->calibreFunciones;
  2428.     }
  2429.     public function setCalibreFunciones(?array $calibreFunciones): static
  2430.     {
  2431.         $this->calibreFunciones = $calibreFunciones;
  2432.         return $this;
  2433.     }
  2434.     public function getDescripcionDetallada(): ?string
  2435.     {
  2436.         return $this->descripcionDetallada;
  2437.     }
  2438.     public function setDescripcionDetallada(?string $descripcionDetallada): static
  2439.     {
  2440.         $this->descripcionDetallada = $descripcionDetallada;
  2441.         return $this;
  2442.     }
  2443.     public function getPapelesStr():string
  2444.     {
  2445.         return $this->getPapeles() ? 'reloj.con_papeles' : 'reloj.sin_papeles';
  2446.     }
  2447.     public function getCajaStr():string
  2448.     {
  2449.         return $this->getCaja() ? 'reloj.con_caja' : 'reloj.sin_caja';
  2450.     }
  2451.     /**
  2452.      * @return Collection<int, DetalleCompra>
  2453.      */
  2454.     public function getRelojesDerivadosDetalleCompra(): Collection
  2455.     {
  2456.         return $this->relojesDerivadosDetalleCompra;
  2457.     }
  2458.     public function addRelojesDerivadosDetalleCompra(DetalleCompra $relojesDerivadosDetalleCompra): static
  2459.     {
  2460.         if (!$this->relojesDerivadosDetalleCompra->contains($relojesDerivadosDetalleCompra)) {
  2461.             $this->relojesDerivadosDetalleCompra->add($relojesDerivadosDetalleCompra);
  2462.             $relojesDerivadosDetalleCompra->setRelojBaseCompra($this);
  2463.         }
  2464.         return $this;
  2465.     }
  2466.     public function removeRelojesDerivadosDetalleCompra(DetalleCompra $relojesDerivadosDetalleCompra): static
  2467.     {
  2468.         if ($this->relojesDerivadosDetalleCompra->removeElement($relojesDerivadosDetalleCompra)) {
  2469.             // set the owning side to null (unless already changed)
  2470.             if ($relojesDerivadosDetalleCompra->getRelojBaseCompra() === $this) {
  2471.                 $relojesDerivadosDetalleCompra->setRelojBaseCompra(null);
  2472.             }
  2473.         }
  2474.         return $this;
  2475.     }
  2476.     /**
  2477.      * @return Collection<int, ValoracionesRelojesSinStock>
  2478.      */
  2479.     public function getRelojesDerivadosValoracionSinStock(): Collection
  2480.     {
  2481.         return $this->relojesDerivadosValoracionSinStock;
  2482.     }
  2483.     public function addRelojesDerivadosValoracionSinStock(ValoracionesRelojesSinStock $relojesDerivadosValoracionSinStock): static
  2484.     {
  2485.         if (!$this->relojesDerivadosValoracionSinStock->contains($relojesDerivadosValoracionSinStock)) {
  2486.             $this->relojesDerivadosValoracionSinStock->add($relojesDerivadosValoracionSinStock);
  2487.             $relojesDerivadosValoracionSinStock->setRelojBaseSinStock($this);
  2488.         }
  2489.         return $this;
  2490.     }
  2491.     public function removeRelojesDerivadosValoracionSinStock(ValoracionesRelojesSinStock $relojesDerivadosValoracionSinStock): static
  2492.     {
  2493.         if ($this->relojesDerivadosValoracionSinStock->removeElement($relojesDerivadosValoracionSinStock)) {
  2494.             // set the owning side to null (unless already changed)
  2495.             if ($relojesDerivadosValoracionSinStock->getRelojBaseSinStock() === $this) {
  2496.                 $relojesDerivadosValoracionSinStock->setRelojBaseSinStock(null);
  2497.             }
  2498.         }
  2499.         return $this;
  2500.     }
  2501.     /**
  2502.      * @return Collection<int, Reloj>
  2503.      */
  2504.     public function getRelojesDerivados(): Collection
  2505.     {
  2506.         return $this->relojesDerivados;
  2507.     }
  2508.     public function addRelojesDerivado(Reloj $relojesDerivado): static
  2509.     {
  2510.         if (!$this->relojesDerivados->contains($relojesDerivado)) {
  2511.             $this->relojesDerivados->add($relojesDerivado);
  2512.             $relojesDerivado->setRelojBase($this);
  2513.         }
  2514.         return $this;
  2515.     }
  2516.     public function removeRelojesDerivado(Reloj $relojesDerivado): static
  2517.     {
  2518.         if ($this->relojesDerivados->removeElement($relojesDerivado)) {
  2519.             // set the owning side to null (unless already changed)
  2520.             if ($relojesDerivado->getRelojBase() === $this) {
  2521.                 $relojesDerivado->setRelojBase(null);
  2522.             }
  2523.         }
  2524.         return $this;
  2525.     }
  2526.     public function getRelojBase(): ?self
  2527.     {
  2528.         return $this->relojBase;
  2529.     }
  2530.     public function setRelojBase(?self $relojBase): static
  2531.     {
  2532.         $this->relojBase = $relojBase;
  2533.         return $this;
  2534.     }
  2535.     public function isCompraDirecta(): ?bool
  2536.     {
  2537.         return $this->compraDirecta;
  2538.     }
  2539.     public function setCompraDirecta(?bool $compraDirecta): static
  2540.     {
  2541.         $this->compraDirecta = $compraDirecta;
  2542.         return $this;
  2543.     }
  2544.     public function isSold():bool
  2545.     {
  2546.         return $this->getEstado()?->getKey() === EstadoRelojEnum::ESTADO_VENDIDO;
  2547.     }
  2548.     public function isSend():bool
  2549.     {
  2550.         return $this->getEstado()?->getKey() === EstadoRelojEnum::ESTADO_ENVIADO;
  2551.     }
  2552.     public function getDiasDesdeRecepcion():?int
  2553.     {
  2554.         $promocion = $this->getPromociones();
  2555.         $fechaRecepcion = $this->getFechaRecepcion() ? clone $this->getFechaRecepcion() : new DateTime();
  2556.         $fechaRecepcion->setTime(0,0,0);
  2557.         $fechaListo = $promocion?->getFechaListo() ? clone $promocion->getFechaListo() : new DateTime();
  2558.         $fechaListo->setTime(0,0,0);
  2559.         $diasDesdeRecepcion = ($fechaRecepcion && $fechaListo) ? $fechaListo->diff($fechaRecepcion)->days : null;
  2560.         return $diasDesdeRecepcion;
  2561.     }
  2562.     public function getDiasDesdeListo():?int
  2563.     {
  2564.         $promocion = $this->getPromociones();
  2565.         $fechaListo = $promocion?->getFechaListo() ? clone $promocion->getFechaListo() : new DateTime();
  2566.         $fechaListo->setTime(0,0,0);
  2567.         $fechaAnuncio = $this->getFechaAnuncio() ? clone $this->getFechaAnuncio() : new DateTime();
  2568.         if($fechaAnuncio) $fechaAnuncio->setTime(0,0,0);
  2569.         $diasDesdeListo = ($fechaListo && $fechaAnuncio) ? $fechaAnuncio->diff($fechaListo)->days : null;
  2570.         return $diasDesdeListo;
  2571.     }
  2572.     public function getDiasDesdeAnuncio():?int
  2573.     {
  2574.         return $this->getTiempoEnVenta();
  2575.     }
  2576.     public function updateDerivedTimes()
  2577.     {
  2578.         $fechaAnuncio = $this->getFechaAnuncio() ? clone $this->getFechaAnuncio() : null;
  2579.         if($fechaAnuncio) $fechaAnuncio->setTime(0,0,0);
  2580.         $fechaVenta = $this->getFechaVenta() ? clone $this->getFechaVenta() : ( $this->getFechaBaja() ? clone $this->getFechaBaja() : new DateTime());
  2581.         $fechaVenta->setTime(0,0,0);
  2582.         $fechaRecepcion = $this->getFechaRecepcion() ? clone $this->getFechaRecepcion() : new DateTime();
  2583.         $fechaRecepcion->setTime(0,0,0);
  2584.         $this->tiempoEnVenta = ($fechaVenta && $fechaAnuncio) ? $fechaVenta->diff($fechaAnuncio)->days : null;
  2585.         $this->tiempoEnStock = ($fechaVenta && $fechaRecepcion) ? $fechaVenta->diff($fechaRecepcion)->days : null;
  2586.     }
  2587.     public function calculateCostesCompra(): float
  2588.     {
  2589.         $accionesCostes = $this->getPromociones()?->getAcciones()?->filter(fn($accion) => $accion instanceof AccionMejora || $accion instanceof AccionServicio) ?? [];
  2590.         return array_sum( $accionesCostes->map(fn($accion) => $accion->getCoste())->toArray() );
  2591.     }
  2592.     public function calculateCostesVenta(): float
  2593.     {
  2594.         $accionesCostes = $this->getPromociones()?->getAcciones()?->filter(fn($accion) => $accion instanceof AccionVenta) ?? [];
  2595.         return array_sum( $accionesCostes->map(fn($accion) => $accion->getCoste())->toArray() );
  2596.     }
  2597.     public function updatePrecioCosteTotal():void
  2598.     {
  2599.         $this->setPrecioCosteTotal($this->getPrecioCompra() + $this->calculateCostesCompra());
  2600.     }
  2601.     public function getIvaImportacion():float
  2602.     {
  2603.         $accionImport = $this->getPromociones()?->getAcciones()?->filter(fn($accion) => $accion instanceof AccionEstado && $accion->isImport()) ?? [];
  2604.         return $accionImport->getCoste();
  2605.     }
  2606.     public function isAvailable(): bool
  2607.     {
  2608.         return !$this->getDetalleVenta()->exists(
  2609.             fn(int $key, DetalleVenta $detalle) => !$detalle->getOperacion()?->isCancelled()
  2610.         );
  2611.     }
  2612.     public function hasOperacionGestion():bool
  2613.     {
  2614.         return $this->getOperacionGestion() !== null;
  2615.     }
  2616.     public function hasOperacionCompra():bool
  2617.     {
  2618.         return $this->getOperacionCompra() !== null;
  2619.     }
  2620.     public function hasOperacionVenta():bool
  2621.     {
  2622.         return $this->getOperacionVenta() !== null;
  2623.     }
  2624.     /**
  2625.      * Campo virtual exclusivo para la API que indica si el reloj es de gestión.
  2626.      * @JMS\VirtualProperty()
  2627.      * @JMS\SerializedName("isGestion")
  2628.      * @JMS\Groups({
  2629.      *     "api_v1_reloj_serialize"
  2630.      * })
  2631.      * @return bool
  2632.      */
  2633.     public function getIsGestion():bool
  2634.     {
  2635.         return $this->hasOperacionGestion();
  2636.     }
  2637.     /**
  2638.      * Campo virtual exclusivo para la API que obtiene el precio CHRONO24.
  2639.      * @JMS\VirtualProperty()
  2640.      * @JMS\SerializedName("precio_chrono")
  2641.      * @JMS\Groups({
  2642.      *     "api_v1_reloj_serialize",
  2643.      *     "api_v1_valoracion_serialize"
  2644.      * })
  2645.      * @return null|float
  2646.      */
  2647.     public function getPrecioChrono24():?float
  2648.     {
  2649.         return $this->getAccionAnuncioChrono()?->getPrecio();
  2650.     }
  2651.     /**
  2652.      * Campo virtual exclusivo para la API que obtiene el fecha CHRONO24.
  2653.      * @JMS\VirtualProperty()
  2654.      * @JMS\SerializedName("fecha_chrono")
  2655.      * @JMS\Groups({
  2656.      *     "api_v1_reloj_serialize",
  2657.      *     "api_v1_valoracion_serialize"
  2658.      * })
  2659.      * @return null|float
  2660.      */
  2661.     public function getFechaChrono24():?DateTime
  2662.     {
  2663.         return $this->getAccionAnuncioChrono()?->getFecha();
  2664.     }
  2665.     /**
  2666.      * @return AccionAnuncio|null
  2667.      */
  2668.     private function getAccionAnuncioChrono():?AccionAnuncio
  2669.     {
  2670.         $criteria = Criteria::create()
  2671.             ->orderBy(['fecha' => Order::Descending]);
  2672.         $anuncioCHRONO24 = $this->getPromociones()
  2673.             ?->getAcciones()
  2674.             ->filter(
  2675.                 fn (AccionAbstract $accion) =>
  2676.                     $accion instanceof AccionAnuncio &&
  2677.                     $accion->getCanal()?->getNombre() === 'CHRONO24'
  2678.             )
  2679.             ->matching($criteria)
  2680.             ->first();
  2681.         return $anuncioCHRONO24 ? $anuncioCHRONO24 : null;
  2682.     }
  2683. }