from django.urls import path

from apps.smehub.investment import views

app_name = "smehub_investment"

urlpatterns = [
    # Hub landing — re-homes Calls / Investors / Matches / My applications (Slice B.2).
    path("", views.InvestmentHubView.as_view(), name="hub"),

    # Admin dashboard
    path("admin/dashboard/", views.InvestmentAdminDashboardView.as_view(), name="admin_dashboard"),
    path("admin/readiness-thresholds/", views.ReadinessThresholdConfigView.as_view(), name="readiness_thresholds"),

    # Investor directory
    path("investors/", views.InvestorDirectoryView.as_view(), name="investor_directory"),
    path("investors/new/", views.InvestorCreateView.as_view(), name="investor_create"),
    path("investors/self-register/", views.InvestorSelfRegisterView.as_view(), name="investor_self_register"),
    path("investors/<int:pk>/", views.InvestorDetailView.as_view(), name="investor_detail"),
    path("investors/<int:pk>/edit/", views.InvestorUpdateView.as_view(), name="investor_update"),
    path(
        "investors/<int:pk>/verify/",
        views.investor_verify_view,
        name="investor_verify",
    ),
    path(
        "investors/<int:pk>/reject/",
        views.investor_reject_view,
        name="investor_reject",
    ),
    path(
        "investors/<int:pk>/deactivate/",
        views.investor_deactivate_view,
        name="investor_deactivate",
    ),
    path(
        "investors/<int:pk>/reactivate/",
        views.investor_reactivate_view,
        name="investor_reactivate",
    ),
    path(
        "investors/admin/<int:pk>/",
        views.InvestorAdminVerifyView.as_view(),
        name="investor_admin_verify",
    ),
    path(
        "investors/admin/queue/",
        views.InvestorAdminQueueView.as_view(),
        name="investor_admin_queue",
    ),

    # Funding calls
    path("funding-calls/", views.FundingCallListView.as_view(), name="funding_calls"),
    path("funding-calls/manage/", views.FundingCallManageView.as_view(), name="funding_call_manage"),
    path("funding-calls/new/", views.FundingCallCreateView.as_view(), name="funding_call_create"),
    path("funding-calls/<int:pk>/", views.FundingCallDetailView.as_view(), name="funding_call_detail"),
    path("funding-calls/<int:pk>/edit/", views.FundingCallUpdateView.as_view(), name="funding_call_update"),
    path("funding-calls/<int:pk>/publish/", views.funding_call_publish_view, name="funding_call_publish"),
    path("funding-calls/<int:pk>/close/", views.funding_call_close_view, name="funding_call_close"),
    path(
        "funding-calls/<int:pk>/applications/",
        views.FundingCallApplicationsView.as_view(),
        name="funding_call_applications",
    ),

    # Funding applications
    path(
        "funding-calls/<int:pk>/apply/",
        views.FundingApplicationStartView.as_view(),
        name="funding_application_start",
    ),
    path(
        "funding-applications/<int:pk>/",
        views.FundingApplicationDetailView.as_view(),
        name="funding_application_detail",
    ),
    path(
        "funding-applications/<int:pk>/edit/",
        views.FundingApplicationEditView.as_view(),
        name="funding_application_edit",
    ),
    path(
        "funding-applications/<int:pk>/auto-save/",
        views.funding_application_autosave_view,
        name="funding_application_autosave",
    ),
    path(
        "funding-applications/<int:pk>/submit/",
        views.funding_application_submit_view,
        name="funding_application_submit",
    ),
    path(
        "funding-applications/<int:pk>/withdraw/",
        views.funding_application_withdraw_view,
        name="funding_application_withdraw",
    ),
    path(
        "funding-applications/<int:pk>/decide/",
        views.funding_application_decide_view,
        name="funding_application_decide",
    ),
    path(
        "my-funding-applications/",
        views.MyFundingApplicationsView.as_view(),
        name="my_funding_applications",
    ),

    # Investor matchmaking
    path("matches/", views.InvestorMatchListView.as_view(), name="investor_match_list"),
    path("matches/refresh/", views.investor_match_refresh_view, name="investor_match_refresh"),

    # SME performance dashboard
    path(
        "performance/me/",
        views.SMEPerformanceDashboardView.as_view(),
        name="performance_dashboard",
    ),
    path(
        "performance/share/",
        views.share_dashboard_view,
        name="share_dashboard",
    ),
    path(
        "performance/share/<int:pk>/revoke/",
        views.revoke_dashboard_share_view,
        name="revoke_dashboard_share",
    ),
    path(
        "performance/shared/<uuid:token>/",
        views.SMEPerformanceSharedView.as_view(),
        name="performance_dashboard_shared",
    ),

    # Investor pitch flow
    path(
        "investor-requests/",
        views.MyInvestorRequestsView.as_view(),
        name="my_investor_requests",
    ),
    path(
        "investor-requests/inbox/",
        views.InvestorPitchInboxView.as_view(),
        name="investor_pitch_inbox",
    ),
    path(
        "investor-requests/<int:pk>/",
        views.InvestorRequestDetailView.as_view(),
        name="investor_request_detail",
    ),
    path(
        "investors/<int:pk>/pitch/",
        views.InvestorPitchRequestView.as_view(),
        name="investor_pitch_request",
    ),
    path(
        "investor-requests/<int:pk>/accept/",
        views.investor_request_accept_view,
        name="investor_request_accept",
    ),
    path(
        "investor-requests/<int:pk>/decline/",
        views.investor_request_decline_view,
        name="investor_request_decline",
    ),
    path(
        "investor-requests/<int:pk>/withdraw/",
        views.investor_request_withdraw_view,
        name="investor_request_withdraw",
    ),

    # Manual funding records
    path("manual-funding/", views.ManualFundingListView.as_view(), name="manual_funding_list"),
    path("manual-funding/new/", views.ManualFundingCreateView.as_view(), name="manual_funding_create"),

    # Investor workspace
    path("me/", views.InvestorDashboardView.as_view(), name="investor_dashboard"),
    path("me/portfolio/", views.InvestorPortfolioView.as_view(), name="investor_portfolio"),
]
