Coverage for src / lexigram / contracts / tenancy / commands.py: 0%

17 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-08-15 18:57 +0800

1"""Tenancy command value objects.""" 

2 

3from __future__ import annotations 

4 

5from dataclasses import dataclass, field 

6from typing import Any 

7 

8 

9@dataclass(frozen=True) 

10class CreateTenantCommand: 

11 """Command to create a new tenant. 

12 

13 Attributes: 

14 slug: URL-safe, human-readable identifier for the new tenant. 

15 name: Display name of the tenant. 

16 plan: Optional subscription plan name. 

17 config: Static provisioning configuration. 

18 metadata: Arbitrary application-defined metadata. 

19 """ 

20 

21 slug: str 

22 name: str 

23 plan: str | None = None 

24 config: dict[str, Any] = field(default_factory=dict) 

25 metadata: dict[str, Any] = field(default_factory=dict) 

26 

27 

28@dataclass(frozen=True) 

29class UpdateTenantCommand: 

30 """Command to update an existing tenant's mutable fields. 

31 

32 All fields are optional. Only non-``None`` fields are applied. 

33 

34 Attributes: 

35 name: New display name (optional). 

36 plan: New subscription plan (optional). 

37 config: Replacement static config snapshot (optional). 

38 metadata: Replacement metadata (optional). 

39 """ 

40 

41 name: str | None = None 

42 plan: str | None = None 

43 config: dict[str, Any] | None = None 

44 metadata: dict[str, Any] | None = None 

45 

46 

47__all__ = [ 

48 "CreateTenantCommand", 

49 "UpdateTenantCommand", 

50]