<?php

namespace App\Models;

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

#[Fillable([
    'investment_id',
    'month_index',
    'actual_percent',
])]
class InvestmentMonthReturn extends Model
{
    /**
     * @return BelongsTo<Investment, InvestmentMonthReturn>
     */
    public function investment(): BelongsTo
    {
        return $this->belongsTo(Investment::class);
    }

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