<?php

declare(strict_types=1);

namespace App\Models;

use App\Enums\BonusType;
use App\Models\Concerns\LogsHrActivity;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;

class Bonus extends Model
{
    use HasFactory;
    use LogsHrActivity;
    use SoftDeletes;

    protected $fillable = [
        'employee_id',
        'bonus_date',
        'bonus_type',
        'amount',
        'reason',
    ];

    protected function casts(): array
    {
        return [
            'bonus_date' => 'date',
            'bonus_type' => BonusType::class,
            'amount' => 'decimal:2',
        ];
    }

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