<?php
/**
 * Model object generated by: Skipper (http://www.skipper18.com)
 * Do not modify this file manually.
 */

namespace App\Models\AbstractModels;

abstract class AbstractPrintJob extends \Illuminate\Foundation\Auth\User
{
    /**  
     * The table associated with the model.
     * 
     * @var string
     */
    protected $table = 'print_job';
    
    /**  
     * Primary key type.
     * 
     * @var string
     */
    protected $keyType = 'bigInteger';
    
    /**  
     * The model's default values for attributes.
     * 
     * @var array
     */
    // protected $attributes = ['is_gruppo' => 0];
    
    /**  
     * The attributes that should be cast to native types.
     * 
     * @var array
     */
    protected $casts = [
        'id' => 'integer',  
        'ordine_id' => 'integer',
        'dispositivo_id' => 'integer',
        'stampante_id' => 'integer',
        'tipo' => 'string',
        'stato' => 'string',
        'payload' => 'json',
        'attempts' => 'integer',
        'last_error' => 'string',
        'queued_at' => 'datetime',
        'printed_at' => 'datetime',
        'failed_at' => 'datetime',
        'created_at' => 'datetime',
        'updated_at' => 'datetime'
    ];
    
    /**  
     * The attributes that are mass assignable.
     * 
     * @var array
     */
    protected $fillable = [
        'id',
        'ordine_id',
        'dispositivo_id',
        'tipo',
        'stampante_id',
        'stato',
        'payload',
        'attempts',
        'last_error',
        'queued_at',
        'printed_at',
        'failed_at',
        'created_at',
        'updated_at'
    ];
    
    public function dispositivo()
    {
        return $this->belongsTo('\App\Models\Dispositivo', 'dispositivo_id', 'id');
    }

    public function ordine()
    {
        return $this->belongsTo('\App\Models\Ordine', 'ordine_id', 'id');
    }

    public function stampante()
    {
        return $this->belongsTo('\App\Models\Dispositivo', 'stampante_id', 'id');
    }
}
