<?php

namespace App\Models;

use App\Models\Concerns\InteractsWithActivityLog;
use Illuminate\Database\Eloquent\Attributes\Guarded;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\MorphTo;

#[Guarded(['id'])]
class Rejection extends Model
{
    // 1. Use Trait
    use HasFactory, InteractsWithActivityLog;

    // 2. Relation
    public function rejectable(): MorphTo
    {
        return $this->morphTo();
    }

    public function rejectedBy(): BelongsTo
    {
        return $this->belongsTo(User::class, 'rejected_by_id');
    }
}
