<?php
namespace App\Entities\Pedidos;

use App\Entities\Configuracion\UbicacionesEntity;
use App\Models\Configuracion\UbicacionesModel;
use CodeIgniter\Entity;

class PedidoLineaEntity extends \CodeIgniter\Entity\Entity
{
    protected $attributes = [
        "id" => null,
        "pedido_id" => null,
        "presupuesto_id" => null,
        "ubicacion_id" => null,
        "user_created_id" => null,
        "user_updated_id" => null,
        "created_at" => null,
        "updated_at" => null,
        "cantidad" => null,
        "descripcion" => null,
    ];

  
    protected $casts = [
        "pedido_id" => "int",
        "presupuesto_id" => "int",
        "ubicacion_id" => "int",
        "cantidad" => "int",
    ];
    public function ubicacion() : UbicacionesEntity
    {
        $m = model(UbicacionesModel::class);
        return $m->find($this->attributes["ubicacion_id"]);
    }
}
