<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use App\Models\User;

class Recharge extends Model
{
    protected $fillable = [
        'user_id','tran_id','number','operator','type','amount','cashback',
        'status','debited','refunded','cashback_applied',
        'pre_voucher_balance','post_voucher_balance','last_response',
        'upline_commissions_applied'
    ];

    protected $casts = [
        'last_response' => 'array',
        'upline_commissions_applied' => 'array',
        'debited' => 'boolean',
        'refunded' => 'boolean',
        'cashback_applied' => 'boolean',
        'amount' => 'float',
        'cashback' => 'float',
        'pre_voucher_balance' => 'float',
        'post_voucher_balance' => 'float',
    ];

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