import { createCrudRoutes } from '../../../utils/generic-crud.routes';
import { authMiddleware } from '../../../middleware/auth.middleware';
import { LocationEntity } from '../../../modules/locations/location.entity';
import {
  createLocationSchema,
  updateLocationSchema,
  getLocationSchema,
  locationListResponseSchema
} from '../../../modules/locations/location.schema';

// 使用通用CRUD路由创建地点管理API
export default createCrudRoutes({
  entity: LocationEntity,
  createSchema: createLocationSchema,
  updateSchema: updateLocationSchema,
  getSchema: getLocationSchema,
  listSchema: locationListResponseSchema,
  searchFields: ['name', 'address'],
  relations: ['province', 'city', 'district'],
  middleware: [authMiddleware]
});