<?php

namespace App\Models;

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

/**
 * ReviewImage Model
 * 
 * Generated by ThrillWiki Model Generator
 * Includes ThrillWiki optimization patterns and performance enhancements
 */
class ReviewImage extends Model
{
    use HasFactory;
    use HasSoftDeletes;

    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'review_images';

    /**
     * The attributes that are mass assignable.
     *
     * @var array<int, string>
     */
    protected $fillable = [
        'name',
        'description',
        'is_active',
        // Add more fillable attributes as needed
    ];

    /**
     * The attributes that should be cast.
     *
     * @var array<string, string>
     */
    protected $casts = [
        'is_active' => 'boolean',
        'created_at' => 'datetime',
        'updated_at' => 'datetime',
        // Add more casts as needed
    ];

    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array<int, string>
     */
    protected $hidden = [
        // Add hidden attributes if needed
    ];

    // Query Scopes
    
    /**
     * Scope a query to only include active records.
     */
    public function scopeActive($query)
    {
        return $query->where('is_active', true);
    }

    /**
     * Scope for optimized queries with common relationships.
     */
    public function scopeOptimized($query)
    {
        return $query->with($this->getOptimizedRelations());
    }

    // ThrillWiki Methods

    /**
     * Get optimized relations for this model.
     */
    public function getOptimizedRelations(): array
    {
        return [
            // Define common relationships to eager load
        ];
    }

    /**
     * Get cache key for this model instance.
     */
    public function getCacheKey(string $suffix = ''): string
    {
        $key = strtolower(class_basename($this)) . '.' . $this->id;
        return $suffix ? $key . '.' . $suffix : $key;
    }




}