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

48 statements  

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

1from typing import List 

2from pydantic import BaseModel, RootModel, Field 

3from datetime import datetime 

4 

5 

6class AdBase(BaseModel): 

7 ContractNaturalId: int 

8 PlanetId: str = Field(min_length=32) 

9 PlanetNaturalId: str 

10 PlanetName: str 

11 CreatorCompanyId: str = Field(min_length=32) 

12 CreatorCompanyName: str 

13 CreatorCompanyCode: str 

14 DeliveryTime: int 

15 CreationTimeEpochMs: datetime 

16 ExpiryTimeEpochMs: datetime 

17 MinimumRating: str 

18 

19 

20class Ad(AdBase): 

21 MaterialId: str = Field(min_length=32) 

22 MaterialName: str 

23 MaterialTicker: str 

24 MaterialCategory: str = Field(min_length=32) 

25 MaterialWeight: float 

26 MaterialVolume: float 

27 MaterialAmount: int 

28 Price: float 

29 PriceCurrency: str 

30 

31 

32class ShippingAd(AdBase): 

33 OriginPlanetId: str = Field(min_length=32) 

34 OriginPlanetNaturalId: str 

35 OriginPlanetName: str 

36 DestinationPlanetId: str = Field(min_length=32) 

37 DestinationPlanetNaturalId: str 

38 DestinationPlanetName: str 

39 CargoWeight: float 

40 CargoVolume: float 

41 PayoutPrice: int 

42 PayoutCurrency: str 

43 

44 

45class LocalMarketAds(BaseModel): 

46 BuyingAds: List[Ad] 

47 SellingAds: List[Ad] 

48 ShippingAds: List[ShippingAd] 

49 

50 

51class LocalMarketAdList(RootModel): 

52 root: List[Ad] 

53 

54 def __iter__(self): 

55 return iter(self.root) 

56 

57 

58class LocalMarketShippingAdList(RootModel): 

59 root: List[ShippingAd] 

60 

61 def __iter__(self): 

62 return iter(self.root)