<?php

declare(strict_types=1);

namespace App\Models;

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

class WorldEditorialSuggestionState extends Model
{
    use HasFactory;

    public const STATUS_PINNED = 'pinned';

    public const STATUS_DISMISSED = 'dismissed';

    public const STATUS_NOT_RELEVANT = 'not_relevant';

    protected $fillable = [
        'world_id',
        'related_type',
        'related_id',
        'status',
        'section_key',
        'acted_by_user_id',
    ];

    protected $casts = [
        'related_id' => 'integer',
        'world_id' => 'integer',
        'acted_by_user_id' => 'integer',
    ];

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

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