<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Model;

class Impresora extends Model
{
    protected $table = 'impresoras';

    public $timestamps = false;

    protected $fillable = [
        'empresa_id',
        'sucursal_id',
        'nombre',
        'tipo',
        'ip',
        'puerto',
        'activa',
    ];

    protected function casts(): array
    {
        return [
            'activa' => 'boolean',
            'created_at' => 'datetime',
        ];
    }

    public function sucursal(): BelongsTo
    {
        return $this->belongsTo(Sucursal::class, 'sucursal_id');
    }
    public function empresa(): BelongsTo
    {
        return $this->belongsTo(Empresa::class, 'empresa_id');
    }
}
