<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class ExpenseReminder extends Model
{
    protected $fillable = [
        'recurring_expense_id','branch_id','due_date','reminder_date','expense_id','message','status','acknowledged_by','acknowledged_at',
    ];

    protected function casts(): array
    {
        return ['due_date'=>'date','reminder_date'=>'date','acknowledged_at'=>'datetime'];
    }

    public function recurringExpense(): BelongsTo { return $this->belongsTo(RecurringExpense::class); }
    public function branch(): BelongsTo { return $this->belongsTo(Branch::class); }
    public function expense(): BelongsTo { return $this->belongsTo(Expense::class); }
    public function acknowledger(): BelongsTo { return $this->belongsTo(User::class, 'acknowledged_by'); }
}