import { services } from "../../../helper/authServices";
import { Authorize } from "./_components/Authorize";

export type Service = (typeof services)[number];

export default async function Page({
	searchParams,
}: {
	searchParams: Promise<{ client_id: string; service: string }>;
}) {
	const { service: serviceId, client_id: clientId } = await searchParams;

	const service = services.find((service) => service.id === serviceId || service.id === clientId);

	if (!service) {
		return <div>Service not found</div>;
	}

	return <Authorize service={service} />;
}
