<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class ApplicationDocument extends Model
{
    protected $fillable = [
        'application_id',
        'document_rule_id',
        'document_type_id',
        'customer_document_id',
        'display_name',
        'attachment_path',
        'is_mandatory',
        'status',
        'source_entity',
        'rejection_reason',
        'verified_by',
        'verified_at',
    ];

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

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

    public function application()
    {
        return $this->belongsTo(Application::class);
    }

    public function documentType()
    {
        return $this->belongsTo(DocumentType::class, 'document_type_id');
    }
}
