<?php

namespace App\Models;

use App\Modules\Users\Models\User;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

/**
 * @property int $id
 * @property int $user_id
 * @property string|null $original_prompt
 * @property string|null $enhanced_prompt
 * @property string $prompt
 * @property string|null $style
 * @property string|null $aspect_ratio
 * @property string|null $model
 * @property string|null $quality
 * @property string|null $image_url
 * @property string $status
 * @property string|null $provider
 * @property array<string, mixed>|null $meta
 */
class ImageGeneration extends Model
{
    public const STATUS_QUEUED = 'queued';

    public const STATUS_FAILED = 'failed';

    public const STATUS_COMPLETED = 'completed';

    protected $table = 'image_generations';

    protected $fillable = [
        'user_id',
        'original_prompt',
        'enhanced_prompt',
        'prompt',
        'style',
        'aspect_ratio',
        'model',
        'quality',
        'image_url',
        'status',
        'provider',
        'meta',
    ];

    /**
     * @return array<string, string>
     */
    protected function casts(): array
    {
        return [
            'meta' => 'array',
        ];
    }

    /** @return BelongsTo<User, ImageGeneration> */
    public function user(): BelongsTo
    {
        return $this->belongsTo(User::class);
    }
}
