<?php

namespace App\Exceptions;

use RuntimeException;

/**
 * Refused: this address already belongs to the other identity table.
 *
 * R21 — operators and customers are two groups of people, never one row that
 * could pass for both. Keyed on the address itself, not on who happens to be
 * signed in when the check runs (see the deleted Customer::assertNotAdmin(),
 * which checked the caller's session and mis-fired for exactly that reason).
 */
class IdentityCollisionException extends RuntimeException
{
    public function __construct(public readonly string $email)
    {
        parent::__construct("Refusing to create or link a portal login for {$email}: that address already belongs to an operator (R21).");
    }
}
