<?php

namespace App\Domain\Accounting\Exceptions;

use RuntimeException;

/**
 * A posting rule referred to an account code the chart does not have.
 *
 * Its own class so an automatic posting can survive a chart that has not been
 * configured yet, while a hand-written journal still fails loudly.
 */
class LedgerAccountMissing extends RuntimeException
{
    public static function forCode(string $code): self
    {
        return new self(
            "No ledger account with code [{$code}]. The chart of accounts has not been seeded, ".
            'or a posting rule refers to an account that was removed.'
        );
    }
}
