import DashboardErrorPage from 'components/sections/dashboard/Home/Dashboard/DashboardErrorPage';
import DashboardLoading from 'components/sections/dashboard/Home/Dashboard/DashboardLoading';
import ProfessionalUpgrade from 'components/sections/dashboard/Home/Upgrade/ProfessionalUpgrade';
import PropertyOwnerUpgrade from 'components/sections/dashboard/Home/Upgrade/PropertyOwnerUpgrade';
import { AccountContext } from 'contexts/AccountContext';
import { useContext } from 'react';
import { UserAPI } from 'types';

export type UpgradeProps = {
  account: UserAPI;
};

const UpgradePage: React.FC = () => {
  const { account, accountLoading } = useContext(AccountContext);

  if (accountLoading) {
    return <DashboardLoading />;
  }

  if (!account) {
    return <DashboardErrorPage />;
  }
  if (account.user_type === 'property_owner') {
    return <PropertyOwnerUpgrade onUpgradeClick={() => {}} />;
  } else if (account.user_type === 'vendor') {
    return <ProfessionalUpgrade userType={account.user_type} onUpgradeClick={() => {}} />;
  } else if (account.user_type === 'attorney') {
    return <ProfessionalUpgrade userType={account.user_type} onUpgradeClick={() => {}} />;
  } else if (account.user_type === 'real_estate_agent') {
    return <ProfessionalUpgrade userType={account.user_type} onUpgradeClick={() => {}} />;
    //return (<VendorProfile account={account} />)
  }
};

export default UpgradePage;
