<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Device extends Model
{
    protected $table = 'devices';

    protected $fillable = [
        'imei',
        'sim_number',
        'consumer_id',
        'firmware_version',
        'device_model',
        'last_seen',
        'signal_strength',
        'battery_level',
        'status'
    ];

    public function consumer()
    {
        return $this->belongsTo(GsmConsumer::class, 'consumer_id');
    }

    public function feeders()
    {
        return $this->hasMany(Feeder::class, 'device_id');
    }
}