import { b as TimeEntry } from '../../types-ecK2b88Z.js'; import { NextRequest, NextResponse } from 'next/server'; import { PrismaClient } from '@prisma/client'; import { Session, AuthOptions } from 'next-auth'; interface ExtendedUser { id: string; email?: string | null; name?: string | null; image?: string | null; role: string; developerId?: string; clientId?: string; } interface ExtendedSession extends Session { user: ExtendedUser; } interface RouteConfig { prisma: PrismaClient; authOptions: AuthOptions; } /** * Create Time Entry route handlers */ declare function createTimeEntryRoutes(config: RouteConfig): { GET: (request: NextRequest) => Promise | NextResponse<{ error: any; }>>; POST: (request: NextRequest) => Promise | NextResponse<{ error: any; }>>; PUT: (request: NextRequest) => Promise | NextResponse<{ error: any; }>>; DELETE: (request: NextRequest) => Promise>; }; /** * Create Timesheet route handlers */ declare function createTimesheetRoutes(config: RouteConfig): { GET: (request: NextRequest) => Promise | NextResponse<{ error: any; }>>; POST: (request: NextRequest) => Promise | NextResponse<{ error: any; }>>; }; /** * Create Reports route handlers */ declare function createReportsRoutes(config: RouteConfig): { GET: (request: NextRequest) => Promise | NextResponse<{ error: any; }>>; }; /** * Middleware utilities for Next.js routes */ /** * Rate limiting middleware */ declare function withRateLimit(limit?: number, window?: number): (handler: Function) => (request: NextRequest, ...args: any[]) => Promise; /** * CORS middleware */ declare function withCors(allowedOrigins?: string[]): (handler: Function) => (request: NextRequest, ...args: any[]) => Promise; /** * Logging middleware */ declare function withLogging(logger?: (log: LogEntry) => void): (handler: Function) => (request: NextRequest, ...args: any[]) => Promise; interface LogEntry { method: string; url: string; status: number; duration: number; error?: string; timestamp: string; } /** * Compose multiple middleware functions */ declare function composeMiddleware(...middlewares: Function[]): (handler: Function) => Function; /** * Authentication utilities for Next.js routes */ declare enum UserRole { ADMIN = "ADMIN", FINANCE = "FINANCE", CLIENT = "CLIENT", DEVELOPER = "DEVELOPER" } interface AuthUser { id: string; email: string; role: UserRole; developerId?: string; clientId?: string; } interface AuthSession extends Session { user: AuthUser; } /** * Check if user has required role */ declare function hasRole(session: AuthSession | null, requiredRoles: UserRole[]): boolean; /** * Enforce role-based access control */ declare function requireRole(session: AuthSession | null, requiredRoles: UserRole[]): void; /** * Check if user can access developer resources */ declare function canAccessDeveloper(session: AuthSession | null, developerId: string): boolean; /** * Check if user can access client resources */ declare function canAccessClient(session: AuthSession | null, clientId: string): boolean; /** * Check if user can approve time entries */ declare function canApproveTimeEntries(session: AuthSession | null): boolean; /** * Check if user can lock time periods */ declare function canLockTimePeriods(session: AuthSession | null): boolean; /** * Check if user can generate invoices */ declare function canGenerateInvoices(session: AuthSession | null): boolean; /** * Get authorization filters based on user role */ declare function getAuthFilters(session: AuthSession | null): Record; export { type AuthSession, type AuthUser, type ExtendedSession, type ExtendedUser, type RouteConfig, UserRole, canAccessClient, canAccessDeveloper, canApproveTimeEntries, canGenerateInvoices, canLockTimePeriods, composeMiddleware, createReportsRoutes, createTimeEntryRoutes, createTimesheetRoutes, getAuthFilters, hasRole, requireRole, withCors, withLogging, withRateLimit };