<?php
class DevolucionEntity Extends DevolucionRepository{
    private $options = array(
        'fecha'=>null,
        'cliente'=>null,        
        'idVenta'=>null,
        'notas'=>null,
        'status'=>null,
        'idCaja'=>null,
        'creado_por'=>null,
        'creado_fecha'=>null,
        'modificaciones'=>null
    );
    
    private $options_aux = array(
        'detalleDevolucion'=>null,
        'pagoDevolucion'=>null,
        'usuarioName'=>null
    );
    
    public function setOptions($data){
      foreach ($this->options as $option => $value){
          if(isset($data[$option])){
            $this->options[$option] = $data[$option];
          }
      }
      
      foreach ($this->options_aux as $option => $value){
          if(isset($data[$option])){
            $this->options_aux[$option] = $data[$option];
          }
      }
    }
  
    public function getOptions(){
        return $this->options;
    }
    
    public function getUsuarioName(){        
        return $this->options_aux['usuarioName'];
    }
    
    public function getFechaCreacion(){
        return $this->options['creado_fecha'];
    }
    
    public function getDevolucionDetalles($idDevolucion = null){
        if(trim($idDevolucion) !== null){
            $idDevolucion = $this->getId();
        }
        return parent::getDevolucionDetalles($idDevolucion);
    }
    
    public function getPagosDetalleByIdDevolucion($idDevolucion = null){
        if(trim($idDevolucion) !== null){
            $idDevolucion = $this->getId();
        }
        return parent::getPagosDetalleByIdDevolucion($idDevolucion);
    }
}