<?php

namespace App\Models\Finance;

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

class Refund extends Model
{
    use SoftDeletes;

    protected $table = 'refunds';

    protected $fillable = [
        'tenant_id',
        'type',
        'customer_name',
        'request_date',
        'product_name',
        'original_amount',
        'refund_amount',
        'reason',
        'status',
        'process_date',
        'note',
    ];

    protected $casts = [
        'original_amount' => 'integer',
        'refund_amount' => 'integer',
        'request_date' => 'date',
        'process_date' => 'date',
    ];

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