<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class ApplicationChoice extends Model
{
    use HasFactory;

    protected $fillable = [
        'application_id', 'programme_id', 'choice_number', 'is_eligible', 'eligibility_report',
    ];

    protected function casts(): array
    {
        return [
            'is_eligible' => 'boolean',
            'eligibility_report' => 'array',
        ];
    }

    public function application(): BelongsTo
    {
        return $this->belongsTo(Application::class);
    }

    public function programme(): BelongsTo
    {
        return $this->belongsTo(Programme::class);
    }

    public function label(): string
    {
        return "Choice {$this->choice_number}";
    }
}
