<?php

namespace App\Entities\Tarifas\Maquinas;

use App\Entities\Configuracion\Maquina;
use App\Entities\Tarifas\TarifaEncuadernacionEntity;
use App\Models\Configuracion\MaquinaModel;
use App\Models\Tarifas\TarifaEncuadernacionModel;
use CodeIgniter\Entity\Entity;


class TarifaEncuadernacionMaquinaEntity extends Entity
{
    protected $attributes = [
        "id" => null,
        "tarifa_encuadernacion_id" => null,
        "maquina_id" => null,
        "maquina_tarea_id" => null,


    ];
    protected $casts = [
        "id" => "integer",
        "tarifa_encuadernacion_id" => "integer",
        "maquina_id" => "integer",
        "maquina_tarea_id" => "?integer",


    ];

    public function tarifa_encuadernacion(): TarifaEncuadernacionEntity
    {
        $m = model(TarifaEncuadernacionModel::class);
        return $m->find($this->attributes["tarifa_encuadernacion_id"]);
    }
    public function maquina(): ?Maquina
    {
        $m = model(MaquinaModel::class);
        return $m->find($this->attributes['maquina_id']);
    }
}
