11from datetime import date
2- from typing import List , Optional , Self
2+ from typing import Self
33
44from pydantic import BaseModel , Field
55
1010class ParcelResponseBody (BaseModel ):
1111 pin : str
1212 address : str
13- distance : Optional [ str ]
14- neighborhood : Optional [ str ]
15- assessed_value : Optional [ str ]
16- taxable_value : Optional [ str ]
17- sale_price : Optional [ str ]
18- sale_date : Optional [ date ]
19- property_class : Optional [ str ]
20- year_built : Optional [ int ]
21- total_sq_ft : Optional [ float ]
22- building_sq_ft : Optional [ float ]
23- land_sq_ft : Optional [ float ]
24- stories : Optional [ str ]
25- rooms : Optional [ int ]
26- baths : Optional [ str ]
27- bedrooms : Optional [ int ]
28- exterior : Optional [ str ]
29- basement : Optional [ str ]
30- garage : Optional [ str ]
31- building_type : Optional [ str ]
32- condition : Optional [ str ]
33- sale_validity : Optional [ str ]
13+ distance : str | None
14+ neighborhood : str | None
15+ assessed_value : str | None
16+ taxable_value : str | None
17+ sale_price : str | None
18+ sale_date : date | None
19+ property_class : str | None
20+ year_built : int | None
21+ total_sq_ft : float | None
22+ building_sq_ft : float | None
23+ land_sq_ft : float | None
24+ stories : str | None
25+ rooms : int | None
26+ baths : str | None
27+ bedrooms : int | None
28+ exterior : str | None
29+ basement : str | None
30+ garage : str | None
31+ building_type : str | None
32+ condition : str | None
33+ sale_validity : str | None
3434 eligible : bool
3535
3636 @classmethod
3737 def from_parcel (
3838 cls ,
3939 parcel : ParcelType ,
40- distance : Optional [ float ] = None ,
40+ distance : float | None = None ,
4141 ) -> Self :
4242 building_sq_ft = getattr (parcel , "building_sq_ft" , None )
4343 total_floor_area = getattr (parcel , "total_floor_area" , None )
@@ -150,11 +150,11 @@ def clean_eligible(cls, parcel: ParcelType) -> bool:
150150
151151class SearchResponseBody (BaseModel ):
152152 uuid : str
153- search_properties : List [ParcelResponseBody ] = Field (default_factory = list )
153+ search_properties : list [ParcelResponseBody ] = Field (default_factory = list )
154154
155155
156156class EligibilityBody (BaseModel ):
157- hope : Optional [ bool ] = None
157+ hope : bool | None = None
158158 owner : bool
159159 residence : bool
160160
@@ -167,16 +167,16 @@ class UserFormBody(BaseModel):
167167 city : str
168168 state : str
169169 phone : str
170- phonetype : Optional [ str ] = None
171- altcontact : Optional [ str ] = None
172- mailingsame : Optional [ str ] = None
173- heardabout : Optional [ str ] = None
170+ phonetype : str | None = None
171+ altcontact : str | None = None
172+ mailingsame : str | None = None
173+ heardabout : str | None = None
174174
175175
176176class UserPropertyBody (BaseModel ):
177- validcharacteristics : Optional [ str ] = None
178- characteristicsinput : Optional [ str ] = None
179- valueestimate : Optional [ str ] = None
177+ validcharacteristics : str | None = None
178+ characteristicsinput : str | None = None
179+ valueestimate : str | None = None
180180
181181
182182class FileBody (BaseModel ):
@@ -187,41 +187,41 @@ class RequestBody(BaseModel):
187187 pin : str
188188 uuid : str
189189 region : str
190- eligibility : Optional [ EligibilityBody ]
191- eligible : Optional [ bool ]
190+ eligibility : EligibilityBody | None
191+ eligible : bool | None
192192 resumed : bool = False
193- selected_comparables : List [str ] = Field (default_factory = list )
194- selected_primary : Optional [ str ] = None
195- agreement : Optional [ bool ]
196- agreement_date : Optional [ date ]
197- agreement_name : Optional [ str ]
198- terms_name : Optional [ str ] = None
199- user : Optional [ UserFormBody ]
200- property : Optional [ UserPropertyBody ]
201- damage : Optional [ str ]
202- damage_level : Optional [ str ]
203- economic_obsolescence : Optional [ bool ] = None
204- files : List [FileBody ] = []
193+ selected_comparables : list [str ] = Field (default_factory = list )
194+ selected_primary : str | None = None
195+ agreement : bool | None
196+ agreement_date : date | None
197+ agreement_name : str | None
198+ terms_name : str | None = None
199+ user : UserFormBody | None
200+ property : UserPropertyBody | None
201+ damage : str | None
202+ damage_level : str | None
203+ economic_obsolescence : bool | None = None
204+ files : list [FileBody ] = []
205205
206206
207207class ResponseBody (BaseModel ):
208208 pin : str
209209 uuid : str
210210 region : str
211- target : Optional [ ParcelResponseBody ]
211+ target : ParcelResponseBody | None
212212 # TODO: search_properties for initial loading?
213- eligibility : Optional [ EligibilityBody ]
214- eligible : Optional [ bool ]
213+ eligibility : EligibilityBody | None
214+ eligible : bool | None
215215 resumed : bool
216- selected_comparables : List [str ]
217- selected_primary : Optional [ str ]
218- agreement : Optional [ bool ]
219- agreement_date : Optional [ date ]
220- agreement_name : Optional [ str ]
221- comparables : List [ParcelResponseBody ]
222- user : Optional [ UserFormBody ]
223- property : Optional [ UserPropertyBody ]
224- damage : Optional [ str ]
225- damage_level : Optional [ str ]
226- economic_obsolescence : Optional [ bool ]
227- files : List [FileBody ] = Field (default_factory = list )
216+ selected_comparables : list [str ]
217+ selected_primary : str | None
218+ agreement : bool | None
219+ agreement_date : date | None
220+ agreement_name : str | None
221+ comparables : list [ParcelResponseBody ]
222+ user : UserFormBody | None
223+ property : UserPropertyBody | None
224+ damage : str | None
225+ damage_level : str | None
226+ economic_obsolescence : bool | None
227+ files : list [FileBody ] = Field (default_factory = list )
0 commit comments