<?php
namespace App\Models\Configuracion;

class TipologiasLibroModel extends \App\Models\BaseModel
{
    protected $table = "lg_tipologias_libros";

    /**
     * Whether primary key uses auto increment.
     *
     * @var bool
     */
    protected $useAutoIncrement = true;

    protected $allowedFields = ["nombre", "code"];
    protected $returnType = "App\Entities\Configuracion\TipologiasEntity";

    public static $labelField = "nombre";

    protected $validationRules = [
        "code" => [
            "label" => "TipologiasLibros.code",
            "rules" => "trim|required|max_length[5]|is_unique[lg_tipologias_libros.code,id,{id}]",
        ],
        "nombre" => [
            "label" => "TipologiasLibros.nombre",
            "rules" => "trim|required|max_length[255]",
        ],
    ];

    protected $validationMessages = [
        "code" => [
            "is_unique" => "TipologiasLibros.validation.code.is_unique",
            "max_length" => "TipologiasLibros.validation.code.max_length",
            "required" => "TipologiasLibros.validation.code.required",
        ],
        "nombre" => [
            "max_length" => "TipologiasLibros.validation.nombre.max_length",
            "required" => "TipologiasLibros.validation.nombre.required",
        ],
    ];
}
