# ADR-0001: E27 as a First-Class Protocol Backend

Status: Accepted

## Context

The elkm1 project historically supported the Elk M1 protocol only.
The E27 panel introduces fundamentally different protocol semantics,
including JSON APIs, session-based encryption, discovery, and authorization.

Attempting to integrate E27 via conditional logic inside the M1 backend
would introduce fragility, reduce clarity, and risk regressions.

## Decision

E27 is implemented as a first-class protocol backend.

- E27 logic is not embedded in the M1 backend.
- The E27 backend owns:
  - handshake
  - protocol state machine
  - framing
  - crypto
  - session management
- M1 behavior remains unchanged.

Protocol selection is performed at runtime based on URL scheme.

## Rationale

E27 and M1 differ at every architectural layer.
A clean backend separation preserves correctness, testability,
and long-term maintainability.

## Consequences

- Shared logic must live above the backend boundary.
- New protocols can be added without destabilizing M1.
- Backward compatibility with existing M1 users is preserved.

## Scope / Non-Goals

- Does not define E27 wire protocol details.
- Does not mandate code structure inside the backend.

## References

- E27 API Comms Protocol
- HelpDealerAPI_UL documentation
