<?php

namespace App\Models\Interview;

use App\Models\User;
use App\Traits\BelongsToTenant;
use App\Traits\ModelTrait;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class InterviewKnowledge extends Model
{
    use BelongsToTenant, ModelTrait, SoftDeletes;

    protected $table = 'interview_knowledge';

    protected $fillable = [
        'tenant_id',
        'interview_project_id',
        'domain',
        'knowledge_type',
        'title',
        'content',
        'source_type',
        'source_id',
        'confidence',
        'is_verified',
        'verified_by',
        'verified_at',
        'created_by',
    ];

    protected $casts = [
        'content' => 'array',
        'confidence' => 'decimal:2',
        'is_verified' => 'boolean',
        'verified_at' => 'datetime',
    ];

    public function project()
    {
        return $this->belongsTo(InterviewProject::class, 'interview_project_id');
    }

    public function verifier()
    {
        return $this->belongsTo(User::class, 'verified_by');
    }

    public function creator()
    {
        return $this->belongsTo(User::class, 'created_by');
    }
}
