<?php

declare(strict_types=1);

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class UserMention extends Model
{
    protected $table = 'user_mentions';

    public $timestamps = false;

    protected $fillable = [
        'user_id',
        'mentioned_user_id',
        'artwork_id',
        'comment_id',
        'created_at',
    ];

    protected $casts = [
        'user_id' => 'integer',
        'mentioned_user_id' => 'integer',
        'artwork_id' => 'integer',
        'comment_id' => 'integer',
        'created_at' => 'datetime',
    ];

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

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

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

    public function comment(): BelongsTo
    {
        return $this->belongsTo(ArtworkComment::class, 'comment_id');
    }
}
