<?php

namespace App\Models;

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

class Deposit extends Model
{
    protected $fillable = [
        'user_id', 'network', 'address', 'amount', 'tx_hash',
        'voucher_path', 'status', 'admin_note', 'processed_by', 'processed_at'
    ];

    protected function casts(): array
    {
        return [
            'amount' => 'decimal:8',
            'processed_at' => 'datetime',
        ];
    }

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

    public function processedBy(): BelongsTo
    {
        return $this->belongsTo(AdminUser::class, 'processed_by');
    }
}
