<?php
namespace App\Entities\Tarifas\Maquinas;

use App\Entities\Tarifas\Acabados\TarifaAcabadoEntity;
use App\Entities\Configuracion\Maquina;
use App\Models\Configuracion\MaquinaModel;
use App\Models\Tarifas\Acabados\TarifaAcabadoModel;
use CodeIgniter\Entity\Entity;


class TarifaAcabadoMaquinaEntity extends Entity
{
    protected $attributes = [
        "id" => null,
        "tarifa_acabado_id" => null,
        "maquina_id" => null,
        "maquina_tarea_id" => null,
    ];
    protected $casts = [
        "id" => "integer",
        "tarifa_acabado_id" => "integer",
        "maquina_id" => "integer",
        "maquina_tarea_id" => "?integer",

    ];

    public function tarifa_acabado(): TarifaAcabadoEntity
    {
        $m = model(TarifaAcabadoModel::class);
        return $m->find($this->attributes["tarifa_acabado_id"]);
    }
    public function maquina() : Maquina
    {
        $m = model(MaquinaModel::class);
        return $m->find($this->attributes["maquina_id"]);

    }
}
