<?php

namespace App\Domain\HR\Models;

use App\Domain\Shared\Traits\BelongsToAcademy;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class TrainerRateHistory extends Model
{
    use BelongsToAcademy;

    protected $fillable = [
        'academy_id',
        'trainer_id',
        'field',
        'old_value',
        'new_value',
        'effective_from',
        'changed_by',
        'notes',
    ];

    protected $casts = [
        'effective_from' => 'date',
    ];

    // --- Relationships ---

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

    public function changedBy(): BelongsTo
    {
        return $this->belongsTo(\App\Models\User::class, 'changed_by');
    }
}
