<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class JobApplication extends Model
{
    protected $fillable = [
    'career_id','name','email','phone','resume',
    'resume_score','status','source','ip_address','user_agent'
];


    // Default values
    protected $attributes = [
        'status' => 0,
        'source' => 'Website',
    ];

    // Relationship with Career
    public function career()
    {
        return $this->belongsTo(Career::class);
    }

    // Status Label Accessor 🔥
    public function getStatusLabelAttribute()
    {
        return [
            0 => 'New',
            1 => 'Reviewed',
            2 => 'Shortlisted',
            3 => 'Rejected',
        ][$this->status] ?? 'Unknown';
    }
}