<?php

namespace App\Database\Seeds;

use App\Models\Configuracion\ConfigVariableModel;
use CodeIgniter\Database\Seeder;

class DefaultConfigVariablesSeeder extends Seeder
{
    protected array $data = [
        [
            "name" => "tamanio_solapas_min",
            "value" => 50,
            "description" => "Mínimo tamaño solapas"
        ],
        [
            "name" => "tamanio_solapas_max",
            "value" => 150,
            "description" => "Máximo tamaño solapas"
        ],
        [
            "name" => "limite_produccion_diaria",
            "value" => 6000,
            "description" => "Número de libros máximos que se puede producir al día"
        ],
    ];
    public function run()
    {
        
        $variableModel = model(ConfigVariableModel::class);
        foreach ($this->data as $row) {
            if($variableModel->where("name",$row["name"])->first() == null){
                $variableModel->insert($row);
            }
        }
    }
}