Coverage for fio_wrapper/models/sites_models.py: 100%

53 statements  

« prev     ^ index     » next       coverage.py v7.3.2, created at 2023-11-16 11:50 +0100

1from typing import List, Optional 

2from datetime import datetime 

3from pydantic import BaseModel, RootModel, Field, NaiveDatetime 

4 

5 

6class SiteBuildingMaterial(BaseModel): 

7 MaterialId: str = Field(min_length=32) 

8 MaterialName: str 

9 MaterialTicker: str = Field(max_length=3) 

10 MaterialAmount: int 

11 

12 

13class SiteBuilding(BaseModel): 

14 ReclaimableMaterials: List[SiteBuildingMaterial] 

15 RepairMaterials: List[SiteBuildingMaterial] 

16 

17 SiteBuildingId: str = Field(min_length=65) 

18 BuildingId: str = Field(min_length=32) 

19 BuildingCreated: datetime 

20 BuildingName: str 

21 BuildingTicker: str = Field(max_length=3) 

22 BuildingLastRepair: Optional[datetime] 

23 Condition: float 

24 

25 

26class Site(BaseModel): 

27 Buildings: List[SiteBuilding] 

28 

29 SiteId: str = Field(min_length=32) 

30 PlanetId: str = Field(min_length=32) 

31 PlanetIdentifier: str 

32 PlanetName: str 

33 PlanetFoundedEpochMs: datetime 

34 InvestedPermits: int 

35 MaximumPermits: int 

36 UserNameSubmitted: str 

37 Timestamp: NaiveDatetime 

38 

39 

40class SiteList(RootModel): 

41 root: List[Site] 

42 

43 def __iter__(self): 

44 return iter(self.root) 

45 

46 

47class Warehouse(BaseModel): 

48 WarehouseId: str = Field(min_length=65) 

49 StoreId: str = Field(min_length=32) 

50 Units: int 

51 WeightCapacity: int 

52 VolumeCapacity: int 

53 NextPaymentTimestampEpochMs: datetime 

54 FeeAmount: int 

55 FeeCurrency: str 

56 FeeCollectorId: Optional[str] 

57 FeeCollectorName: Optional[str] 

58 FeeCollectorCode: Optional[str] 

59 LocationName: str 

60 LocationNaturalId: str 

61 UserNameSubmitted: str 

62 Timestamp: NaiveDatetime 

63 

64 

65class WarehouseList(RootModel): 

66 root: List[Warehouse] 

67 

68 def __iter__(self): 

69 return iter(self.root)