import { useState } from 'react';
import { PATHS } from '@/shared/constants/paths';
import { useNavigate } from '@/shared/lib/hooks/use-navigate';
import { FundAccountTab } from '@/entities/additional-service/ui/fund-account/tab';
import { FundAccountTransferListWrap } from '@/entities/additional-service/ui/fund-account/transfer-list-wrap';
import { FundAccountTabKeys } from '@/entities/additional-service/model/fund-account/types';
import { HeaderType } from '@/entities/common/model/types';
import {
  useSetHeaderTitle,
  useSetHeaderType,
  useSetFooterMode,
  useSetOnBack
} from '@/widgets/sub-layout/use-sub-layout';
import { useExtensionAccessCheck } from '@/shared/lib/hooks/use-extension-access-check';

export const FundAccountTransferListPage = () => {
  const { navigate } = useNavigate();
  // 권한 체크
  const { hasAccess, AccessDeniedDialog } = useExtensionAccessCheck({
    extensionCode: 'FUND_ACCOUNT'
  });
  const [activeTab, setActiveTab] = useState<FundAccountTabKeys>(FundAccountTabKeys.TransferList);

  useSetHeaderTitle('자금이체');
  useSetHeaderType(HeaderType.LeftArrow);
  useSetFooterMode(false);
  useSetOnBack(() => {
    navigate(PATHS.home);
  });

  // if (!hasAccess) {
  //   return <AccessDeniedDialog />;
  // }

  return (
    <>
      <main>
        <div className="tab-content">
          <div className="tab-pane pt-46 active">
            <FundAccountTab activeTab={activeTab}></FundAccountTab>
            <FundAccountTransferListWrap></FundAccountTransferListWrap>
          </div>
        </div>
      </main>
    </>
  );
};