1313 from stapi_fastapi .backends .product_backend import ProductBackend
1414
1515
16+ type Constraints = BaseModel
17+
18+
1619class ProviderRole (str , Enum ):
1720 licensor = "licensor"
1821 producer = "producer"
@@ -28,7 +31,7 @@ class Provider(BaseModel):
2831
2932 # redefining init is a hack to get str type to validate for `url`,
3033 # as str is ultimately coerced into an AnyHttpUrl automatically anyway
31- def __init__ (self , url : AnyHttpUrl | str , ** kwargs ):
34+ def __init__ (self , url : AnyHttpUrl | str , ** kwargs ) -> None :
3235 super ().__init__ (url = url , ** kwargs )
3336
3437
@@ -44,31 +47,38 @@ class Product(BaseModel):
4447 links : list [Link ] = Field (default_factory = list )
4548
4649 # we don't want to include these in the model fields
47- _constraints : type [OpportunityProperties ]
50+ _constraints : type [Constraints ]
51+ _opportunity_properties : type [OpportunityProperties ]
4852 _order_parameters : type [OrderParameters ]
4953 _backend : ProductBackend
5054
5155 def __init__ (
5256 self ,
5357 * args ,
5458 backend : ProductBackend ,
55- constraints : type [OpportunityProperties ],
59+ constraints : type [Constraints ],
60+ opportunity_properties : type [OpportunityProperties ],
5661 order_parameters : type [OrderParameters ],
5762 ** kwargs ,
5863 ) -> None :
5964 super ().__init__ (* args , ** kwargs )
6065 self ._backend = backend
6166 self ._constraints = constraints
67+ self ._opportunity_properties = opportunity_properties
6268 self ._order_parameters = order_parameters
6369
6470 @property
6571 def backend (self : Self ) -> ProductBackend :
6672 return self ._backend
6773
6874 @property
69- def constraints (self : Self ) -> type [OpportunityProperties ]:
75+ def constraints (self : Self ) -> type [Constraints ]:
7076 return self ._constraints
7177
78+ @property
79+ def opportunity_properties (self : Self ) -> type [OpportunityProperties ]:
80+ return self ._opportunity_properties
81+
7282 @property
7383 def order_parameters (self : Self ) -> type [OrderParameters ]:
7484 return self ._order_parameters
0 commit comments