<?php

namespace App\Modules\HR\Recruitment\Models;

use App\Models\User;
use App\Modules\Admin\Tenancy\Traits\BelongsToTenant;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;

class RecruitmentInterviewScorecard extends Model
{
    use BelongsToTenant;
    use SoftDeletes;

    protected $table = 'recruitment_interview_scorecards';

    protected $fillable = [
        'tenant_id',
        'reference_code',
        'interview_id',
        'overall_score',
        'recommendation',
        'strengths',
        'weaknesses',
        'notes',
        'scored_by',
        'scored_at',
    ];

    protected function casts(): array
    {
        return [
            'overall_score' => 'integer',
            'scored_at' => 'datetime',
        ];
    }

    public function interview(): BelongsTo
    {
        return $this->belongsTo(RecruitmentInterview::class, 'interview_id');
    }

    public function scoredByUser(): BelongsTo
    {
        return $this->belongsTo(User::class, 'scored_by');
    }
}
