"""Airport-related models for Duffel API."""
from pydantic import BaseModel, Field, ConfigDict
from .common import ResponseFormat
from ..config import DEFAULT_PAGE_LIMIT, MAX_PAGE_LIMIT
class ListAirportsInput(BaseModel):
"""Input for listing airports."""
model_config = ConfigDict(str_strip_whitespace=True, validate_assignment=True, extra='forbid')
country_code: str | None = Field(
default=None,
description="Filter by ISO 3166-1 alpha-2 country code (e.g., 'US', 'GB', 'FR')",
min_length=2,
max_length=2
)
limit: int = Field(
default=DEFAULT_PAGE_LIMIT,
description="Number of results per page (1-200)",
ge=1,
le=MAX_PAGE_LIMIT
)
response_format: ResponseFormat = Field(
default=ResponseFormat.MARKDOWN,
description="Output format: 'json' for raw data or 'markdown' for readable summary"
)
class SearchAirportsInput(BaseModel):
"""Input for searching airports by name or code."""
model_config = ConfigDict(str_strip_whitespace=True, validate_assignment=True, extra='forbid')
query: str = Field(
...,
description="Search query - airport name, city, or IATA code (e.g., 'London', 'Heathrow', 'LHR')",
min_length=2,
max_length=100
)
limit: int = Field(
default=20,
description="Maximum number of results to return (1-100)",
ge=1,
le=100
)
response_format: ResponseFormat = Field(
default=ResponseFormat.MARKDOWN,
description="Output format: 'json' for raw data or 'markdown' for readable summary"
)