import type { FormattedQuoteResponse } from "@hooks/apis/common/quote/types";
import { isAutoQuote } from "@hooks/apis/common/quote/useQuote";

export const areBothRoutesSame = (
	routeOne?: FormattedQuoteResponse,
	routeTwo?: FormattedQuoteResponse,
) => {
	if (!routeOne || !routeTwo) return false;

	const isRouteOneAuto = isAutoQuote(routeOne);
	const isRouteTwoAuto = isAutoQuote(routeTwo);

	if (isRouteOneAuto) {
		return isRouteTwoAuto;
	}

	// if routeOne is not auto
	if (isRouteTwoAuto) return false;
	return routeOne.routeId === routeTwo.routeId;
};
