<?php

namespace App\Models;

use App\Enums\ForexImportStagingStatus;
use Illuminate\Database\Eloquent\Attributes\Fillable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

#[Fillable([
    'status',
    'row_checksum',
    'csv_record_index',
    'email_hint',
    'first_name',
    'last_name',
    'contact_number',
    'country',
    'wallet_address',
    'amount',
    'duration_months',
    'confirmed_at',
    'maturity_at',
    'monthly_return_snapshot',
    'payload',
    'investment_id',
])]
class ForexImportStagingItem extends Model
{
    /**
     * @return BelongsTo<Investment, ForexImportStagingItem>
     */
    public function investment(): BelongsTo
    {
        return $this->belongsTo(Investment::class);
    }

    protected function casts(): array
    {
        return [
            'status' => ForexImportStagingStatus::class,
            'amount' => 'decimal:2',
            'monthly_return_snapshot' => 'decimal:2',
            'confirmed_at' => 'datetime',
            'maturity_at' => 'datetime',
            'payload' => 'array',
        ];
    }
}
