<?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 WorldRelation extends Model
{
    use HasFactory;

    public const TYPE_ARTWORK = 'artwork';
    public const TYPE_COLLECTION = 'collection';
    public const TYPE_USER = 'user';
    public const TYPE_GROUP = 'group';
    public const TYPE_NEWS = 'news';
    public const TYPE_CHALLENGE = 'challenge';
    public const TYPE_EVENT = 'event';
    public const TYPE_RELEASE = 'release';
    public const TYPE_CARD = 'card';

    protected $fillable = [
        'world_id',
        'related_type',
        'related_id',
        'section_key',
        'context_label',
        'sort_order',
        'is_featured',
    ];

    protected $casts = [
        'related_id' => 'integer',
        'sort_order' => 'integer',
        'is_featured' => 'boolean',
    ];

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