<?php

namespace App\Models\Finance;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class CardTransaction extends Model
{
    use SoftDeletes;

    protected $table = 'card_transactions';

    protected $fillable = [
        'tenant_id',
        'card_id',
        'transaction_date',
        'time',
        'merchant',
        'category',
        'amount',
        'approval_no',
        'status',
        'memo',
    ];

    protected $casts = [
        'transaction_date' => 'date',
        'amount' => 'integer',
    ];

    public function scopeForTenant($query, $tenantId)
    {
        return $query->where('tenant_id', $tenantId);
    }
}
