<?php

// app/Models/MerchantDocument.php

namespace App\Models;

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

class MerchantDocument extends Model
{
    use HasFactory;

    protected $fillable = [
        'merchant_id', 'document_type', 'document_number', 'file_path',
        'file_name', 'mime_type', 'file_size', 'issue_date', 'expiry_date',
        'is_verified', 'verified_by', 'verified_at', 'metadata',
    ];

    protected $casts = [
        'issue_date' => 'date',
        'expiry_date' => 'date',
        'is_verified' => 'boolean',
        'verified_at' => 'datetime',
        'metadata' => 'array',
    ];

    public function merchant()
    {
        return $this->belongsTo(Merchant::class);
    }

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