<?php

namespace App\Models\OrdenTrabajo;

use App\Entities\Produccion\OrdenTrabajoUserEntity;
use CodeIgniter\Database\MySQLi\Builder;
use CodeIgniter\Model;

class OrdenTrabajoUser extends Model
{
    protected $table            = 'orden_trabajo_users';
    protected $primaryKey       = 'orden_trabajo_id';
    protected $useAutoIncrement = false;
    protected $returnType       = OrdenTrabajoUserEntity::class;
    protected $useSoftDeletes   = true;
    protected $protectFields    = true;
    protected $allowedFields    = [
        "orden_trabajo_id",
        "user_created_id",
        "user_update_id",
        "inaplazable_revised_change_user_id",
        "ferro_disponible_hecho_user_id",
        "ferro_disponible_ok_user_id",
        "ferro_entregado_user_id",
        "pendiente_ferro_user_id",
        "ferro_en_cliente_user_id",
        "ferro_ok_user_id",
        "interior_bn_user_id",
        "interior_color_user_id",
        "preparacion_interior_user_id",
        "cubierta_user_id",
        "plastificado_user_id",
        "encuadernacion_user_id",
        "corte_user_id",
        "embalaje_user_id",
        "entrada_manipulado_user_id",
        "pre_formato_user_id",
        "pre_lomo_user_id",
        "pre_solapa_user_id",
        "pre_codbarras_user_id",
        "pre_imposicion_user_id",
        "pre_imprimir_user_id"
    ];

    protected bool $allowEmptyInserts = false;
    protected bool $updateOnlyChanged = true;

    protected array $casts = [
        "orden_trabajo_id" => "integer",
        "user_created_id" => "?integer",
        "user_update_id" => "?integer",
        "inaplazable_revised_change_user_id" => "?integer",
        "ferro_disponible_hecho_user_id" => "?integer",
        "ferro_disponible_ok_user_id" => "?integer",
        "ferro_entregado_user_id" => "?integer",
        "pendiente_ferro_user_id" => "?integer",
        "ferro_en_cliente_user_id" => "?integer",
        "ferro_ok_user_id" => "?integer",
        "interior_bn_user_id" => "?integer",
        "interior_color_user_id" => "?integer",
        "preparacion_interior_user_id" => "?integer",
        "cubierta_user_id" => "?integer",
        "plastificado_user_id" => "?integer",
        "encuadernacion_user_id" => "?integer",
        "corte_user_id" => "?integer",
        "embalaje_user_id" => "?integer",
        "entrada_manipulado_user_id" => "?integer",
        "pre_formato_user_id" => "?integer",
        "pre_lomo_user_id" => "?integer",
        "pre_solapa_user_id" => "?integer",
        "pre_codbarras_user_id" => "?integer",
        "pre_imposicion_user_id" => "?integer",
        "pre_imprimir_user_id" => "?integer"
    ];
    protected array $castHandlers = [];

    // Dates
    protected $useTimestamps = true;
    protected $dateFormat    = 'datetime';
    protected $createdField  = 'created_at';
    protected $updatedField  = 'updated_at';
    protected $deletedField  = 'deleted_at';

    // Validation
    protected $validationRules      = [];
    protected $validationMessages   = [];
    protected $skipValidation       = false;
    protected $cleanValidationRules = true;

    // Callbacks
    protected $allowCallbacks = true;
    protected $beforeInsert   = [];
    protected $afterInsert    = [];
    protected $beforeUpdate   = [];
    protected $afterUpdate    = [];
    protected $beforeFind     = [];
    protected $afterFind      = [];
    protected $beforeDelete   = [];
    protected $afterDelete    = [];

    

}
