<?php

namespace App\Trait;

use App\Models\Document\Document;
use Illuminate\Database\Eloquent\Relations\MorphMany;

trait HasDocuments {
    /**
     * Get all documents associated with the current model.
     */
    public function documents(): MorphMany {
        return $this->morphMany(Document::class, 'owner');
    }

    /**
     * Abstract method to be implemented by the owner model.
     * This method defines where the documents for *this specific model type* should be stored.
     *
     * @return string
     */
    abstract public function getDocumentStoragePath(): string;
}