<?php

namespace App\Models\Interview;

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

class InterviewTemplate extends Model
{
    use Auditable, BelongsToTenant, ModelTrait, SoftDeletes;

    protected $fillable = [
        'tenant_id',
        'interview_category_id',
        'name',
        'description',
        'sort_order',
        'is_active',
        'created_by',
        'updated_by',
        'deleted_by',
    ];

    protected $casts = [
        'is_active' => 'boolean',
        'sort_order' => 'integer',
    ];

    protected $hidden = [
        'deleted_at',
    ];

    public function category()
    {
        return $this->belongsTo(InterviewCategory::class, 'interview_category_id');
    }

    public function questions()
    {
        return $this->hasMany(InterviewQuestion::class, 'interview_template_id');
    }
}
