<?php

namespace App\Models;

use CodeIgniter\Model;

class CandidateLanguageModel extends Model
{
    protected $table         = 'candidate_languages';
    protected $allowedFields = ['candidate_profile_id', 'language', 'proficiency'];
    protected $validationRules = [
        'language' => 'required|max_length[100]',
    ];

    public function forProfile(int $candidateProfileId): array
    {
        return $this->where('candidate_profile_id', $candidateProfileId)->findAll();
    }
}
