<?php

namespace App\Services;

use App\Models\Configuracion\MaquinaTareaModel;
use App\Models\Tarifas\Maquinas\TarifaAcabadoMaquinaModel;
use App\Models\Tarifas\Maquinas\TarifaManipuladoMaquinaModel;
use App\Models\Tarifas\Maquinas\TarifaEncuadernacionMaquinaModel;
use App\Models\Tarifas\Maquinas\TarifaPreimpresionMaquinaModel;
use App\Models\Tarifas\Maquinas\TarifaExtraMaquinaModel;
use CodeIgniter\Config\BaseService;
use CodeIgniter\Database\BaseBuilder;
use CodeIgniter\Database\Exceptions\DatabaseException;

/**
 * Clase con las funcionalidades necesarias trabajar con tarifas maquinas
 */

class TarifaMaquinaService extends BaseService
{
    protected TarifaAcabadoMaquinaModel $tarifaAcabadoMaquina;
    protected TarifaManipuladoMaquinaModel $tarifaManipuladoMaquina;
    protected TarifaPreimpresionMaquinaModel $tarifaPreimpresionMaquina;
    protected TarifaEncuadernacionMaquinaModel $tarifaEncuadernacionMaquina;
    protected TarifaExtraMaquinaModel $tarifaExtraMaquina;
    protected MaquinaTareaModel $maquinaTarea;

    public function __construct() {
        $this->tarifaAcabadoMaquina = model(TarifaAcabadoMaquinaModel::class);
        $this->tarifaManipuladoMaquina = model(TarifaManipuladoMaquinaModel::class);
        $this->tarifaEncuadernacionMaquina = model(TarifaEncuadernacionMaquinaModel::class);
        $this->tarifaPreimpresionMaquina = model(TarifaPreimpresionMaquinaModel::class);
        $this->tarifaExtraMaquina = model(TarifaExtraMaquinaModel::class);

    }

    public function attachAcabadoToMaquina(int $tarifa_acabado_id, int $maquina_id, int $maquina_tarea_id): bool|int|string
    {
        return $this->tarifaAcabadoMaquina->insert(["tarifa_acabado_id" => $tarifa_acabado_id, "maquina_id" => $maquina_id, "maquina_tarea_id" => $maquina_tarea_id]);
    }
    public function attachManipuladoToMaquina(int $tarifa_manipulado_id, int $maquina_id, int $maquina_tarea_id): bool|int|string
    {
        return $this->tarifaManipuladoMaquina->insert(["tarifa_manipulado_id" => $tarifa_manipulado_id, "maquina_id" => $maquina_id, "maquina_tarea_id" => $maquina_tarea_id]);
    }
    public function attachPreimpresionToMaquina(int $tarifa_preimpresion_id, int $maquina_id, int $maquina_tarea_id): bool|int|string
    {
        return $this->tarifaPreimpresionMaquina->insert(["tarifa_preimpresion_id" => $tarifa_preimpresion_id, "maquina_id" => $maquina_id, "maquina_tarea_id" => $maquina_tarea_id]);
    }
    public function attachEncuadernacionToMaquina(int $tarifa_encuadernacion_id, int $maquina_id, int $maquina_tarea_id): bool|int|string
    {
        return $this->tarifaEncuadernacionMaquina->insert(["tarifa_encuadernacion_id" => $tarifa_encuadernacion_id, "maquina_id" => $maquina_id, "maquina_tarea_id" => $maquina_tarea_id]);
    }
    public function attachExtraToMaquina(int $tarifa_extra_id, int $maquina_id, int $maquina_tarea_id): bool|int|string
    {
        return $this->tarifaExtraMaquina->insert(["tarifa_extra_id" => $tarifa_extra_id, "maquina_id" => $maquina_id, "maquina_tarea_id" => $maquina_tarea_id]);
    }

}
