<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Relations\BelongsTo;

class BonusItem extends BaseModel
{
    protected $fillable = [
        'bonus_generation_id',
        'employee_id',
        'bonus_amount',
        'breakdown',
    ];

    protected function casts(): array
    {
        return [
            'breakdown' => 'array',
            'bonus_amount' => 'decimal:2',
        ];
    }

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

    public function employee(): BelongsTo
    {
        return $this->belongsTo(User::class, 'employee_id');
    }
}
