Coverage for src / lexigram / contracts / core / identity.py: 0%
15 statements
« prev ^ index » next coverage.py v7.13.5, created at 2026-08-15 18:57 +0800
« prev ^ index » next coverage.py v7.13.5, created at 2026-08-15 18:57 +0800
1"""Identity contracts for the Lexigram framework."""
3from __future__ import annotations
5from enum import StrEnum
6from typing import Protocol, runtime_checkable
9class IdStrategy(StrEnum):
10 """Available ID generation strategies."""
12 UUID4 = "uuid4"
13 UUID7 = "uuid7"
14 ULID = "ulid"
15 PREFIXED = "prefixed"
18@runtime_checkable
19class IdGeneratorProtocol(Protocol):
20 """Injectable identity generator."""
22 @property
23 def strategy(self) -> IdStrategy:
24 """Return the active ID generation strategy."""
25 ...
27 def generate(self) -> str:
28 """Generate a new unique identifier."""
29 ...
31 def generate_for(self, entity_type: str) -> str:
32 """Generate a new identifier for a specific entity type."""
33 ...
36__all__ = ["IdGeneratorProtocol", "IdStrategy"]