import { useRouter } from "next/navigation";
import React from "react";

function CompleteRegister({
  user_name,
  first_name,
  user_type,
}: {
  user_name: string | null;
  first_name: string | null;
  user_type: string | null;
}) {
  const router = useRouter();
  const step =
    typeof window !== "undefined" ? localStorage.getItem("step") : null;
  return (
    <button
      onClick={() => {
        if (!user_name) {
          router.push("/register/username");
        } else if (step === "password") {
          router.push("/register/password");
        } else if (!first_name) {
          router.push("/register/fullname");
        } else if (!user_type) {
          router.push("/register/usertype");
        } else {
          router.push("/verify/avatar");
        }
      }}
      className="flex items-center gap-3 text-xs md:text-sm font-semibold mt-4"
    >
      <div className="w-4 h-4 rounded-full bg-[#FF0000]"></div>
      <span>تکمیل ثبت نام</span>
    </button>
  );
}

export default CompleteRegister;
