<?php

namespace App\Domain\Financial\Events;

use App\Domain\Financial\Models\Settlement;
use App\Models\User;
use Illuminate\Contracts\Events\ShouldDispatchAfterCommit;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;

/**
 * A participant's account was settled.
 *
 * Dispatched after commit so a listener never sees a settlement that was rolled
 * back. Nothing listens yet — notifying the guardian, or telling the branch
 * manager how much was written off this week, belongs on a listener rather than
 * inside the service that moved the money.
 */
class SettlementApplied implements ShouldDispatchAfterCommit
{
    use Dispatchable, SerializesModels;

    public function __construct(
        public Settlement $settlement,
        public User $actor,
    ) {}
}
