from fastapi import APIRouter

from api.v1.common.tenant_crud_routes import TenantCRUDRoutes

from .dto import LocationCreate, LocationResponse, LocationUpdate
from .models import Location
from .service import LocationService

router = TenantCRUDRoutes(
    service=LocationService,
    create_schema=LocationCreate,
    update_schema=LocationUpdate,
    response_schema=LocationResponse,
    prefix="/locations",
    tags=["a76.general_catalogs.locations"],
    resource_name="Location",
    enable_list=True,
    enable_filters=True,
    max_page_size=1000,
    list_permissions=["cat_locations.view"],
    get_permissions=["cat_locations.view"],
    create_permissions=["cat_locations.create"],
    update_permissions=["cat_locations.edit"],
    delete_permissions=["cat_locations.delete"],
).router
