from fastapi import APIRouter

from app.models.avm import (
    AVMPredictRequest,
    AVMPredictResponse,
    FeatureExtractRequest,
    FeatureExtractResponse,
)
from app.services.avm_service import avm_service, feature_extract_service

router = APIRouter(prefix="/avm", tags=["AVM"])


@router.post("/predict", response_model=AVMPredictResponse)
def predict(req: AVMPredictRequest) -> AVMPredictResponse:
    """Predict property price using the Automated Valuation Model."""
    return avm_service.predict(req)


@router.post("/extract-features", response_model=FeatureExtractResponse)
def extract_features(req: FeatureExtractRequest) -> FeatureExtractResponse:
    """Extract real-estate features from Vietnamese listing text."""
    return feature_extract_service.extract(req)
