<?php
namespace App\Models\Tarifas;

class TarifapreimpresionModel extends \App\Models\GoBaseModel
{
    protected $table = "lg_tarifa_preimpresion";

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

    protected $allowedFields = [
        "nombre", 
        "precio_pagina",
        "precio_min",
        "importe_fijo",
        "margen",
        "mostrar_en_presupuesto",
        "deleted_at",
        "is_deleted",
        "user_created_id", 
        "user_updated_id"];
    protected $returnType = "App\Entities\Tarifas\TarifapreimpresionEntity";

    protected $useTimestamps = true;
    protected $useSoftDeletes = false;

    protected $createdField = "created_at";
    protected $updatedField = "updated_at";
    protected $deletedField  = 'deleted_at';

    public static $labelField = "nombre";

    protected $validationRules = [
        "nombre" => [
            "label" => "Tarifapreimpresion.nombre",
            "rules" => "trim|required|max_length[255]",
        ],
        "precio_pagina" => [
            "label" => "Tarifapreimpresion.precio",
            "rules" => "required|decimal",
        ],
        "precio_min" => [
            "label" => "Tarifapreimpresion.precioMin",
            "rules" => "required|decimal",
        ],
        "importe_fijo" => [
            "label" => "Tarifapreimpresion.importeFijo",
            "rules" => "required|decimal",
        ],
        "margen" => [
            "label" => "Tarifapreimpresion.margen",
            "rules" => "required|decimal",
        ],
    ];

    protected $validationMessages = [
        "nombre" => [
            "max_length" => "Tarifapreimpresion.validation.nombre.max_length",
            "required" => "Tarifapreimpresion.validation.nombre.required",
        ],
        "precio_pagina" => [
            "decimal" => "Tarifapreimpresion.validation.precio.decimal",
            "required" => "Tarifapreimpresion.validation.precio.required",
        ],
        "precio_min" => [
            "required" => "Tarifapreimpresion.validation.precio_min.required",
            "decimal" => "Tarifapreimpresion.validation.precio_min.decimal",
        ],
        "importe_fijo" => [
            "required" => "Tarifapreimpresion.validation.importe_fijo.required",
            "decimal" => "Tarifapreimpresion.validation.importe_fijo.decimal",
        ],
        "margen" => [
            "required" => "Tarifapreimpresion.validation.margen.required",
            "decimal" => "Tarifapreimpresion.validation.margen.decimal",
        ],
    ];
}
