<?php
namespace App\Models;
use App\Enums\MerchantStatus;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
class Merchant extends Model { use SoftDeletes; protected $fillable=['code','name','country_id','currency_code','contact_name','contact_phone','contact_email','address','can_send','can_receive','per_txn_min_minor','per_txn_max_minor','daily_limit_minor','float_balance_minor','status']; protected function casts():array{return ['can_send'=>'boolean','can_receive'=>'boolean','per_txn_min_minor'=>'integer','per_txn_max_minor'=>'integer','daily_limit_minor'=>'integer','float_balance_minor'=>'integer','status'=>MerchantStatus::class];} public function country():BelongsTo{return $this->belongsTo(Country::class);} public function users():HasMany{return $this->hasMany(User::class);} public function ledgerEntries():HasMany{return $this->hasMany(LedgerEntry::class);} public function isActive():bool{return $this->status===MerchantStatus::Active;} }
