<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use App\Traits\Auditable;

class PatientDocument extends Model
{
    use HasFactory;
    use Auditable;

    protected $fillable = [
        'id',
        'patient_id',
        'file_name',
        'original_name',
        'file_path',
        'file_size',
        'file_type',
        'description',
        'uploaded_by'
    ];

    /**
     * Get the patient that owns the document
     */
    public function patient()
    {
        return $this->belongsTo(Patients::class, 'patient_id');
    }

    /**
     * Get the user who uploaded the document
     */
    public function uploader()
    {
        return $this->belongsTo(User::class, 'uploaded_by');
    }
}
