<?php

namespace App\Models\Finance;

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

class CondolenceExpense extends Model
{
    use SoftDeletes;

    protected $table = 'condolence_expenses';

    protected $fillable = [
        'tenant_id',
        'event_date',
        'expense_date',
        'partner_name',
        'description',
        'category',
        'has_cash',
        'cash_method',
        'cash_amount',
        'has_gift',
        'gift_type',
        'gift_amount',
        'total_amount',
        'options',
        'memo',
        'created_by',
    ];

    protected $casts = [
        'event_date' => 'date',
        'expense_date' => 'date',
        'has_cash' => 'boolean',
        'has_gift' => 'boolean',
        'cash_amount' => 'integer',
        'gift_amount' => 'integer',
        'total_amount' => 'integer',
        'options' => 'array',
    ];

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