<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class RechargeSetting extends Model
{
    protected $fillable = [
        'api_key','api_secret','min_amount','max_amount','commission_per_1000','upline_commissions'
    ];

    protected $casts = [
        'upline_commissions' => 'array',
    ];

    public static function one(): self
    {
        return static::query()->firstOrCreate([], [
            'min_amount' => 10,
            'max_amount' => 1000,
            'commission_per_1000' => 0,
        ]);
    }
}
