import { NextResponse } from "next/server"

import { bookingFlow } from "@/constants/routes/hotelReservation"

import { getDefaultRequestHeaders } from "./utils"

import type { NextMiddleware } from "next/server"

import type { MiddlewareMatcher } from "@/types/middleware"

export const middleware: NextMiddleware = async (request) => {
  const headers = getDefaultRequestHeaders(request)
  return NextResponse.next({
    request: {
      headers,
    },
  })
}

export const matcher: MiddlewareMatcher = (request) => {
  return bookingFlow.includes(request.nextUrl.pathname)
}
