57 lines
1.3 KiB
Python
57 lines
1.3 KiB
Python
from __future__ import annotations
|
|
|
|
from datetime import datetime
|
|
from decimal import Decimal
|
|
from uuid import UUID
|
|
from typing import Literal
|
|
|
|
from pydantic import BaseModel, ConfigDict
|
|
|
|
from app.schemas.catalog import AmenityOut, ImobiliariaOut, PropertyTypeOut, CityOut, NeighborhoodOut
|
|
|
|
|
|
class PropertyPhotoOut(BaseModel):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
url: str
|
|
alt_text: str
|
|
display_order: int
|
|
|
|
|
|
class PropertyOut(BaseModel):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
id: UUID
|
|
title: str
|
|
slug: str
|
|
code: str | None = None
|
|
price: Decimal
|
|
condo_fee: Decimal | None
|
|
iptu_anual: Decimal | None = None
|
|
type: Literal["venda", "aluguel"]
|
|
subtype: PropertyTypeOut | None
|
|
bedrooms: int
|
|
bathrooms: int
|
|
parking_spots: int
|
|
area_m2: int
|
|
city: CityOut | None
|
|
neighborhood: NeighborhoodOut | None
|
|
imobiliaria: ImobiliariaOut | None = None
|
|
is_featured: bool
|
|
created_at: datetime | None = None
|
|
photos: list[PropertyPhotoOut]
|
|
amenities: list[AmenityOut] = []
|
|
|
|
|
|
class PaginatedPropertiesOut(BaseModel):
|
|
items: list[PropertyOut]
|
|
total: int
|
|
page: int
|
|
per_page: int
|
|
pages: int
|
|
|
|
|
|
class PropertyDetailOut(PropertyOut):
|
|
address: str | None = None
|
|
code: str | None = None
|
|
description: str | None = None
|