<?php

namespace App\Models;

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

class AirtimeToCashRequest extends Model
{
    use HasFactory;

    protected $guarded = [];

    protected $casts = [
        'airtime_amount' => 'decimal:2',
        'rate_percent' => 'decimal:2',
        'payout_amount' => 'decimal:2',
        'proof_json' => 'array',
        'processed_at' => 'datetime',
        'payout_paid_at' => 'datetime',
    ];

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

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

    public function processedByAdmin(): BelongsTo
    {
        return $this->belongsTo(User::class, 'processed_by_admin_id');
    }
}
