<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Str;

/**
 * 
 *
 * @property string $id
 * @property string $bank_id
 * @property string|null $oneapp_code
 * @property string|null $paystack_code
 * @property string|null $monnify_code
 * @property string|null $safeheaven_code
 * @property string|null $fintava_short_code
 * @property string|null $bani_code
 * @property string|null $bani_list_code
 * @property string|null $kora_code
 * @property \Illuminate\Support\Carbon|null $created_at
 * @property \Illuminate\Support\Carbon|null $updated_at
 * @property bool $status
 * @method static \Illuminate\Database\Eloquent\Builder<static>|Bank newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder<static>|Bank newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder<static>|Bank query()
 * @method static \Illuminate\Database\Eloquent\Builder<static>|Bank whereBaniCode($value)
 * @method static \Illuminate\Database\Eloquent\Builder<static>|Bank whereBaniListCode($value)
 * @method static \Illuminate\Database\Eloquent\Builder<static>|Bank whereBankId($value)
 * @method static \Illuminate\Database\Eloquent\Builder<static>|Bank whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder<static>|Bank whereFintavaShortCode($value)
 * @method static \Illuminate\Database\Eloquent\Builder<static>|Bank whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder<static>|Bank whereKoraCode($value)
 * @method static \Illuminate\Database\Eloquent\Builder<static>|Bank whereMonnifyCode($value)
 * @method static \Illuminate\Database\Eloquent\Builder<static>|Bank whereOneappCode($value)
 * @method static \Illuminate\Database\Eloquent\Builder<static>|Bank wherePaystackCode($value)
 * @method static \Illuminate\Database\Eloquent\Builder<static>|Bank whereSafeheavenCode($value)
 * @method static \Illuminate\Database\Eloquent\Builder<static>|Bank whereStatus($value)
 * @method static \Illuminate\Database\Eloquent\Builder<static>|Bank whereUpdatedAt($value)
 * @property string|null $name
 * @method static \Illuminate\Database\Eloquent\Builder<static>|Bank whereName($value)
 * @mixin \Eloquent
 */
class Bank extends Model
{
    use HasFactory;

    protected $table = 'banks';

    protected $keyType = 'string';

    protected $fillable = [
        'name',
        'oneapp_code',
        'paystack_code',
        'monnify_code',
        'safeheaven_code',
        'fintava_short_code',
        'bani_code',
        'bani_list_code',
        'kora_code',
        'status',
    ];

    protected $casts = [
        'status' => 'boolean',
    ];

    // Automatically set UUID for `id` when creating a new record
    protected static function boot()
    {
        parent::boot();
        static::creating(function ($model) {
            if (empty($model->id)) {
                $model->id = (string) Str::uuid();
            }
        });
    }
}
