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
« 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
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
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
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
45class LocalMarketAds(BaseModel):
46 BuyingAds: List[Ad]
47 SellingAds: List[Ad]
48 ShippingAds: List[ShippingAd]
51class LocalMarketAdList(RootModel):
52 root: List[Ad]
54 def __iter__(self):
55 return iter(self.root)
58class LocalMarketShippingAdList(RootModel):
59 root: List[ShippingAd]
61 def __iter__(self):
62 return iter(self.root)