Coverage for src/lexigram/admin/settings/panel/types.py: 100%

13 statements  

« prev     ^ index     » next       coverage.py v7.15.4, created at 2026-08-21 14:26 +0800

1"""Type definitions for Configuration Center.""" 

2 

3from __future__ import annotations 

4 

5from dataclasses import dataclass 

6 

7from lexigram.domain import DomainModel 

8from lexigram.validation import Field 

9 

10__all__ = [ 

11 "ConfigCategory", 

12] 

13 

14 

15@dataclass(init=False) 

16class ConfigCategory(DomainModel): 

17 """A grouping of configuration specs. 

18 

19 Categories organize related configuration specs into logical groups 

20 displayed in the Configuration Center sidebar. One category is built 

21 per distinct ``ConfigSpec.package_source`` registered with the 

22 ``ConfigRegistry`` — see ``SettingsController._build_categories``. 

23 

24 Attributes: 

25 name: Internal identifier — the spec's package_source. 

26 label: Display label shown in the sidebar. 

27 icon: Icon identifier for the category header. 

28 order: Sort order for display (lower = higher priority). 

29 description: Optional description shown in the UI. 

30 """ 

31 

32 name: str 

33 label: str 

34 icon: str = Field(default="folder") 

35 order: int = Field(default=100) 

36 description: str = Field(default="") 

37 

38 # Populated dynamically from registry 

39 specs: list = Field(default_factory=list)