<?php

namespace App\Models;

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

class MeterReading extends Model
{
    use HasFactory;

    protected $fillable = [
        'user_id',
        'meteran_id',
        'image_path',
        'month',
        'year',
        'meter_value',
        'status',
        'admin_notes',
    ];

    protected $casts = [
        'month' => 'integer',
        'year' => 'integer',
        'meter_value' => 'decimal:2',
    ];

    public function user(): BelongsTo
    {
        return $this->belongsTo(User::class);
    }

    public function meteran(): BelongsTo
    {
        return $this->belongsTo(Meteran::class);
    }
}