62 lines
1.6 KiB
Python
62 lines
1.6 KiB
Python
"""Pydantic schemas for image retouch and price comparison endpoints."""
|
|
|
|
import uuid
|
|
from datetime import datetime
|
|
from typing import Optional
|
|
|
|
from pydantic import BaseModel, ConfigDict, Field
|
|
|
|
|
|
class RetouchProcessResponse(BaseModel):
|
|
"""Response for POST /api/v1/retouch/process."""
|
|
|
|
message: str = "Retouch processing queued"
|
|
retouch_id: uuid.UUID
|
|
status: str = "pending"
|
|
|
|
|
|
class RetouchResultResponse(BaseModel):
|
|
"""Response for GET /api/v1/retouch/results/:id."""
|
|
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
id: uuid.UUID
|
|
vehicle_id: Optional[uuid.UUID] = None
|
|
original_file_path: str
|
|
original_file_name: str
|
|
mime_type: str
|
|
retouched_file_path: Optional[str] = None
|
|
status: str
|
|
error_message: Optional[str] = None
|
|
created_at: Optional[datetime] = None
|
|
updated_at: Optional[datetime] = None
|
|
|
|
|
|
class PriceCompareRequest(BaseModel):
|
|
"""Request body for POST /api/v1/retouch/price-compare."""
|
|
|
|
vehicle_id: uuid.UUID = Field(..., description="Vehicle ID to compare prices for")
|
|
|
|
|
|
class ComparableListing(BaseModel):
|
|
"""A single comparable listing from mobile.de or mock data."""
|
|
|
|
title: str
|
|
make: str
|
|
model: str
|
|
year: Optional[int] = None
|
|
price: float
|
|
mileage_km: Optional[int] = None
|
|
location: Optional[str] = None
|
|
url: Optional[str] = None
|
|
source: str = "mobile.de"
|
|
|
|
|
|
class PriceCompareResponse(BaseModel):
|
|
"""Response for POST /api/v1/retouch/price-compare."""
|
|
|
|
vehicle_id: uuid.UUID
|
|
comparable_listings: list[ComparableListing] = Field(default_factory=list)
|
|
average_price: Optional[float] = None
|
|
listing_count: int = 0
|