<?php

/**
 * Created by Reliese Model.
 */

namespace App\Models;

use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
use Pgvector\Laravel\Vector;

/**
 * Class SearchEmbedding
 *
 * @property int $id
 * @property string $type
 * @property int|null $category_id
 * @property int|null $ai_tool_id
 * @property string $query
 * @property USER-DEFINED|null $embedding
 * @property Carbon|null $created_at
 * @property Carbon|null $updated_at
 * @property Category|null $category
 * @property AiTool|null $ai_tool
 */
class SearchEmbedding extends Model
{
    protected $table = 'search_embeddings';

    protected $casts = [
        'category_id' => 'int',
        'ai_tool_id' => 'int',
        'embedding' => Vector::class,
    ];

    protected $fillable = [
        'type',
        'category_id',
        'ai_tool_id',
        'query',
        'embedding',
    ];

    public function category()
    {
        return $this->belongsTo(Category::class);
    }

    public function ai_tool()
    {
        return $this->belongsTo(AiTool::class);
    }
}
