<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class SptjmReport extends Model
{
    protected $fillable = [
        'school_id', 'submitted_by', 'verified_by', 'report_period',
        'student_count', 'sptjm_file_path', 'status', 'rejection_notes',
        'submitted_at', 'verified_at'
    ];

    protected $casts = [
        'submitted_at' => 'datetime',
        'verified_at' => 'datetime',
    ];

    public function school()
    {
        return $this->belongsTo(School::class);
    }

    public function submittedBy()
    {
        return $this->belongsTo(User::class, 'submitted_by');
    }

    public function verifiedBy()
    {
        return $this->belongsTo(User::class, 'verified_by');
    }

    public function scopePending($query)
    {
        return $query->where('status', 'submitted');
    }

    public function scopeVerified($query)
    {
        return $query->where('status', 'verified');
    }
}
