// "use client";

// import { zodResolver } from "@hookform/resolvers/zod";
// import { useForm } from "react-hook-form";
// import { z } from "zod";

// import { Button } from "@/components/ui/button";
// import {
//   Form,
//   FormControl,
//   FormDescription,
//   FormField,
//   FormItem,
//   FormLabel,
//   FormMessage,
// } from "@/components/ui/form";
// import {
//   InputOTP,
//   InputOTPGroup,
//   InputOTPSeparator,
//   InputOTPSlot,
// } from "@/components/ui/input-otp";
// import { toast } from "@/components/ui/use-toast";
// import { adminVerifyOtp } from "@/services/admin-service";
// import { useRouter } from "next/navigation";

// const FormSchema = z.object({
//   pin: z.string().min(4, {
//     message: "Your one-time password must be 4 characters.",
//   }),
// });

// export function InputOTPForm() {
//   const router = useRouter();
//   const form = useForm<z.infer<typeof FormSchema>>({
//     resolver: zodResolver(FormSchema),
//     defaultValues: {
//       pin: "",
//     },
//   });

//   async function onSubmit(data: z.infer<typeof FormSchema>) {

//     const reqserver: { status: string; message: string } = await adminVerifyOtp(
//       data.pin
//     );
//     toast({
//       title: reqserver.message ?? "Try Again",
//     });
//     if (reqserver.status) {
//       router.push("/change-password");
//     }
//   }

//   return (
//     <Form {...form}>
//       <form onSubmit={form.handleSubmit(onSubmit)} className="w-2/3 space-y-6">
//         <FormField
//           control={form.control}
//           name="pin"
//           render={({ field }) => (
//             <FormItem>
//               {/* <FormLabel>One-Time Password</FormLabel> */}
//               <FormControl>
//                 <div className="flex justify-center text-[#FFB300]">
//                   <InputOTP maxLength={4} {...field}>
//                     <InputOTPGroup>
//                       <InputOTPSlot index={0} />
//                     </InputOTPGroup>
//                     <InputOTPSeparator />
//                     <InputOTPGroup>
//                       <InputOTPSlot index={1} />
//                     </InputOTPGroup>
//                     <InputOTPSeparator />
//                     <InputOTPGroup>
//                       <InputOTPSlot index={2} />
//                     </InputOTPGroup>
//                     <InputOTPSeparator />
//                     <InputOTPGroup>
//                       <InputOTPSlot index={3} />
//                     </InputOTPGroup>
//                     {/* <InputOTPSlot index={4} />
//                       <InputOTPSlot index={5} /> */}
//                   </InputOTP>
//                 </div>
//               </FormControl>
//               <FormDescription className="text-white/80">
//                 Please enter the one-time password sent to your Email.
//               </FormDescription>
//               <FormMessage />
//             </FormItem>
//           )}
//         />

//         <Button type="submit" variant="appdefault" className="w-36">
//           Submit
//         </Button>
//       </form>
//     </Form>
//   );
// }
