<?php

declare(strict_types=1);

namespace Kylin\Hr\Models;

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

/**
 * 绩效指标评分模型
 *
 * 管理绩效考核中各项指标的具体得分。
 *
 * @property float  $score   得分
 * @property string $comment 评语
 */
class PerformanceIndicatorScore extends Model
{
    protected $fillable = [
        'appraisal_id',
        'indicator_id',
        'score',
        'evidence',
    ];

    protected function casts(): array
    {
        return [
            'score' => 'decimal:1',
        ];
    }

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

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