<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Log extends Model
{
    protected $table = 'logs';

    public $timestamps = false; // because no updated_at

    protected $fillable = [
        'feeder_id',
        'device_id',
        'voltage',
        'current',
        'power',
        'frequency',
        'power_factor',
        'status',
        'temperature',
        'recorded_at'
    ];

    public function feeder()
    {
        return $this->belongsTo(Feeder::class, 'feeder_id');
    }

    public function device()
    {
        return $this->belongsTo(Device::class, 'device_id');
    }
}