import { completeOnboardingHandler } from '@/modules/onboarding/handlers/complete-onboarding.handler';
import { resendOtpHandler } from '@/modules/onboarding/handlers/resend-otp.handler';
import { startOnboardingHandler } from '@/modules/onboarding/handlers/start-onboarding.handler';
import { verifyOtpHandler } from '@/modules/onboarding/handlers/verify-otp.handler';
import type { AppEnv } from '@/types/hono';
import { zValidator } from '@hono/zod-validator';
import {
  onboardingCompleteSchema,
  onboardingResendOtpSchema,
  onboardingStartSchema,
  onboardingVerifyOtpSchema,
} from '@repo/api-contract';
import { Hono } from 'hono';

export const onboardingRoutes = new Hono<AppEnv>();

onboardingRoutes.post('/start', zValidator('json', onboardingStartSchema), startOnboardingHandler);

onboardingRoutes.post(
  '/verify-otp',
  zValidator('json', onboardingVerifyOtpSchema),
  verifyOtpHandler
);

onboardingRoutes.post(
  '/resend-otp',
  zValidator('json', onboardingResendOtpSchema),
  resendOtpHandler
);

onboardingRoutes.post(
  '/complete',
  zValidator('json', onboardingCompleteSchema),
  completeOnboardingHandler
);
