<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class ExchangeTransaction extends Model
{
    protected $fillable = ['from_account_id', 'to_account_id', 'from_amount', 'to_amount', 'exchange_rate', 'transaction_date', 'reference', 'notes'];
    protected function casts(): array { return ['from_amount' => 'decimal:2', 'to_amount' => 'decimal:2', 'exchange_rate' => 'decimal:6', 'transaction_date' => 'date']; }
    public function fromAccount() { return $this->belongsTo(FinancialAccount::class, 'from_account_id'); }
    public function toAccount() { return $this->belongsTo(FinancialAccount::class, 'to_account_id'); }
}
