"""Original fictional integer-field validators, called exactly by run_cases.py.

Precondition: type(port) is int. This module does not parse or validate types,
open a socket, allocate a real port, or define operating-system binding policy.
"""


def validate_port_baseline(port):
    """Bug: incorrectly excludes the specified inclusive upper endpoint."""
    if port < 1:
        return {"accepted": False, "reason": "too_low"}
    if port >= 65535:
        return {"accepted": False, "reason": "too_high"}
    return {"accepted": True, "port": port}


def validate_port_corrected(port):
    """Implemented correction: reject above, not at, the inclusive endpoint."""
    if port < 1:
        return {"accepted": False, "reason": "too_low"}
    if port > 65535:
        return {"accepted": False, "reason": "too_high"}
    return {"accepted": True, "port": port}


def validate_port_accept_all(port):
    """Seeded wrong control: ignores every invalid integer class."""
    return {"accepted": True, "port": port}


def validate_port_reject_all(port):
    """Seeded wrong control: rejects valid values as well as invalid ones."""
    return {"accepted": False, "reason": "too_low" if port < 1 else "too_high"}
