from django.urls import path
from . import views

urlpatterns = [
    # Media upload
    path('media/upload', views.upload_media_view, name='media_upload'),
    # Video generation
    path('video/generate', views.video_generate_view, name='video_generate'),
    path('video/tasks', views.video_tasks_list_view, name='video_tasks_list'),
    path('video/tasks/<uuid:task_id>', views.video_task_detail_view, name='video_task_detail'),
    path('video/tasks/<uuid:task_id>/favorite', views.video_task_toggle_favorite_view, name='video_task_toggle_favorite'),
    # Public announcement
    path('announcement', views.announcement_view, name='announcement'),
    path('announcement/read', views.announcement_read_view, name='announcement_read'),
    # Admin publish announcement (fan-out to all users)
    path('admin/announcement/publish', views.admin_publish_announcement_view, name='admin_announcement_publish'),

    # ── Super Admin: Dashboard ──
    path('admin/stats', views.admin_stats_view, name='admin_stats'),

    # ── Super Admin: Team management ──
    path('admin/teams', views.admin_teams_list_view, name='admin_teams_list'),
    path('admin/teams/create', views.admin_team_create_view, name='admin_team_create'),
    path('admin/teams/<int:team_id>', views.admin_team_detail_view, name='admin_team_detail'),
    path('admin/teams/<int:team_id>/topup', views.admin_team_topup_view, name='admin_team_topup'),
    path('admin/teams/<int:team_id>/set-pool', views.admin_team_set_pool_view, name='admin_team_set_pool'),
    path('admin/teams/<int:team_id>/admin', views.admin_team_create_admin_view, name='admin_team_create_admin'),
    path('admin/teams/<int:team_id>/members/<int:member_id>/role', views.admin_team_member_role_view, name='admin_team_member_role'),

    # ── Super Admin: User management ──
    path('admin/users', views.admin_users_list_view, name='admin_users_list'),
    path('admin/users/create', views.admin_create_user_view, name='admin_create_user'),
    path('admin/users/<int:user_id>', views.admin_user_detail_view, name='admin_user_detail'),
    path('admin/users/<int:user_id>/quota', views.admin_user_quota_view, name='admin_user_quota'),
    path('admin/users/<int:user_id>/status', views.admin_user_status_view, name='admin_user_status'),
    path('admin/users/<int:user_id>/reset-password', views.admin_reset_password_view, name='admin_reset_password'),
    path('admin/users/<int:user_id>/username', views.admin_user_username_update_view, name='admin_user_username_update'),
    path('admin/users/<int:user_id>/observer', views.admin_user_observer_toggle_view, name='admin_user_observer_toggle'),

    # ── Super Admin: Records, Settings & Audit Logs ──
    path('admin/records', views.admin_records_view, name='admin_records'),
    path('admin/settings', views.admin_settings_view, name='admin_settings'),
    path('admin/logs', views.admin_audit_logs_view, name='admin_audit_logs'),

    # ── Super Admin: Login Records ──
    path('admin/login-records', views.admin_login_records_view, name='admin_login_records'),

    # ── Super Admin: Anomaly Detection ──
    path('admin/anomalies', views.admin_login_anomalies_view, name='admin_login_anomalies'),
    path('admin/test-feishu', views.admin_test_feishu_view, name='admin_test_feishu'),
    path('admin/test-sms', views.admin_test_sms_view, name='admin_test_sms'),
    path('admin/teams/<int:team_id>/auto-learn', views.admin_team_auto_learn_view, name='admin_team_auto_learn'),
    path('admin/teams/<int:team_id>/apply-learned-regions', views.admin_team_apply_learned_regions_view, name='admin_team_apply_learned_regions'),

    # ── Super Admin: Content Assets ──
    path('admin/assets/overview', views.admin_assets_overview, name='admin_assets_overview'),
    path('admin/assets/team/<int:team_id>/members', views.admin_assets_team_members, name='admin_assets_team_members'),
    path('admin/assets/user/<int:user_id>/videos', views.admin_assets_user_videos, name='admin_assets_user_videos'),

    # ── Team Admin: Team management ──
    path('team/info', views.team_info_view, name='team_info'),
    path('team/stats', views.team_stats_view, name='team_stats'),
    path('team/members', views.team_members_list_view, name='team_members_list'),
    path('team/members/create', views.team_member_create_view, name='team_member_create'),
    path('team/members/<int:member_id>', views.team_member_detail_view, name='team_member_detail'),
    path('team/members/<int:member_id>/quota', views.team_member_quota_view, name='team_member_quota'),
    path('team/members/<int:member_id>/status', views.team_member_status_view, name='team_member_status'),
    path('team/members/<int:member_id>/role', views.team_member_role_view, name='team_member_role'),
    path('team/members/<int:member_id>/reset-password', views.team_reset_member_password_view, name='team_reset_member_password'),
    path('team/members/<int:member_id>/username', views.team_member_username_update_view, name='team_member_username_update'),

    # ── Team Admin: Consumption Records ──
    path('team/records', views.team_records_view, name='team_records'),

    # ── Team Admin: Content Assets ──
    path('team/assets/overview', views.team_assets_overview, name='team_assets_overview'),
    path('team/assets/member/<int:member_id>/videos', views.team_assets_member_videos, name='team_assets_member_videos'),

    # ── Profile: User's own data ──
    path('profile/overview', views.profile_overview_view, name='profile_overview'),
    path('profile/records', views.profile_records_view, name='profile_records'),

    # ── Assets API (Virtual Avatar Library) ──
    path('assets/groups', views.asset_groups_view, name='asset_groups'),
    path('assets/groups/<int:group_id>', views.asset_group_detail_view, name='asset_group_detail'),
    path('assets/groups/<int:group_id>/assets', views.asset_group_add_asset_view, name='asset_group_add_asset'),
    path('assets/<int:asset_id>', views.asset_update_view, name='asset_update'),
    path('assets/<int:asset_id>/status', views.asset_poll_status_view, name='asset_poll_status'),
    path('assets/search', views.asset_search_view, name='asset_search'),
]
