<?php

namespace App\Models;

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

class Gallery extends Model
{
    use HasFactory;

    protected $fillable = [
        'floor_id',
        'gallery_name',
        'gallery_icon_path',
        'language',
        'short_description',
        'next_gallery_id',
        'previous_gallery_id', 
    ];

    public function floor()
    {
        return $this->belongsTo(Floor::class);
    }

    public function exhibits()
    {
        return $this->hasMany(Exhibit::class);
    }

    public function nextGallery()
    {
        return $this->belongsTo(Gallery::class, 'next_gallery_id');
    }

    public function previousGallery()
    {
        return $this->belongsTo(Gallery::class, 'previous_gallery_id'); // ✅ Added relation
    }
}
