from api.v1.common.tenant_crud_routes import TenantCRUDRoutes

from .dto import TrailerCreateDTO, TrailerResponseDTO, TrailerUpdateDTO
from .services import TrailerService

# Create router using TenantCRUDRoutes factory
# Note: trailer_number is a string (not int) and is used as the primary key
router = TenantCRUDRoutes(
    service=TrailerService,
    create_schema=TrailerCreateDTO,
    update_schema=TrailerUpdateDTO,
    response_schema=TrailerResponseDTO,
    prefix="/trailers",
    tags=[],
    resource_name="Trailer",
    id_name="trailer_number",  # Using trailer_number instead of numeric ID
    id_type=str,  # Specify that the ID is a string
    enable_list=True,  # Enable GET /trailers with pagination
    enable_filters=True,  # Enable filtering by plate_number and trailer_type_key
    default_page_size=50,
    max_page_size=100,
).router
