# Port Validator
# Validates port ranges and values

{
  # Validate port is in valid range (1024-65535, excluding system ports)
  is_valid_port = fun port =>
    port >= 1024 && port <= 65535,

  # Validate port is not reserved
  is_unreserved_port = fun port =>
    port >= 1024 && port <= 65535,

  # Validate port range
  validate_port = fun port =>
    if is_valid_port port then
      {valid = true}
    else
      {
        valid = false,
        error = "Port must be between 1024 and 65535, got %{std.string.from_number port}",
      },

  # Check port is not system reserved (< 1024)
  is_system_port = fun port =>
    port < 1024,
}
