<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Stancl\Tenancy\Database\Concerns\CentralConnection;

class SpecDocumentAttachment extends Model
{
    use CentralConnection;
    use HasFactory;

    protected $fillable = [
        'spec_document_id',
        'spec_document_section_id',
        'name',
        'path',
        'mime_type',
        'size',
        'created_by',
    ];

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

    public function section(): BelongsTo
    {
        return $this->belongsTo(SpecDocumentSection::class, 'spec_document_section_id');
    }
}
