<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class SavingsInterestHistory extends Model
{
    use HasFactory;

    // Explicit table name to match singular migration
    protected $table = 'savings_interest_history';

    protected $fillable = [
        'savings_wallet_id',
        'amount',
        'rate',
        'calculation_date'
    ];

    protected $casts = [
        'amount' => 'decimal:2',
        'rate' => 'decimal:2',
        'calculation_date' => 'date'
    ];

    public function savingsWallet()
    {
        return $this->belongsTo(SavingsWallet::class);
    }
}
