<?php

namespace App\Models;

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

class Image extends Model
{
    use HasFactory;

    protected $fillable = [
        'gallery_id',
        'path',
        'uuid',
        'original_image_id',
        'style_id',
        'is_temp',
        'is_public',
        'comfyui_prompt_id',
    ];

    protected function casts(): array
    {
        return [
            'is_temp' => 'bool',
            'is_public' => 'bool',
        ];
    }

    public function style()
    {
        return $this->belongsTo(Style::class);
    }

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