import { useState } from "react";
import RequestOtp from "../RequestOtp";
import UserRegister from "./UserRegister";

const NavyComponent = () => {
  const [otpToken, setOtpToken] = useState(false);
  const [PhoneNumber, setPhoneNumber] = useState("");

  // For Resend Token (read ResendToken Component Doc)
  const initialTimerValue = 30;
  const [timer, setTimer] = useState(initialTimerValue);
  // End For Resend Token

  if (!otpToken) {
    return (
      <RequestOtp
        setOtpToken={setOtpToken}
        PhoneNumber={PhoneNumber}
        setPhoneNumber={setPhoneNumber}
        setTimer={setTimer}
        initialTimerValue={initialTimerValue}
      />
    );
  } else {
    return (
      <UserRegister
        PhoneNumber={PhoneNumber}
        setOtpToken={setOtpToken}
        timer={timer}
        setTimer={setTimer}
        initialTimerValue={initialTimerValue}
      />
    );
  }
};

export default NavyComponent;
