from django.urls import path
from scrobbles import views
from tasks.webhooks import EmacsWebhookView, TodoistWebhookView

app_name = "scrobbles"

urlpatterns = [
    path(
        "now-playing/",
        views.NowPlayingPartialView.as_view(),
        name="now-playing-partial",
    ),
    path("calendar/", views.ScrobbleCalendarView.as_view(), name="calendar"),
    path("search/", views.ScrobbleSearchView.as_view(), name="search"),
    path("status/", views.ScrobbleStatusView.as_view(), name="status"),
    path(
        "widget/top-artists/<str:period>/<int:user_id>/",
        views.EmbeddableTopArtistsWidget.as_view(),
        name="embeddable-top-artists",
    ),
    path(
        "widget/top-board-games/<str:period>/<int:user_id>/",
        views.EmbeddableTopBoardGamesWidget.as_view(),
        name="embeddable-top-board-games",
    ),
    path(
        "widget/top-books/<str:period>/<int:user_id>/",
        views.EmbeddableTopBooksWidget.as_view(),
        name="embeddable-top-books",
    ),
    path(
        "widget/top-trails/<str:period>/<int:user_id>/",
        views.EmbeddableTopTrailsWidget.as_view(),
        name="embeddable-top-trails",
    ),
    path(
        "widget/top-foods/<str:period>/<int:user_id>/",
        views.EmbeddableTopFoodsWidget.as_view(),
        name="embeddable-top-foods",
    ),
    path(
        "widget/top-tasks/<str:period>/<int:user_id>/",
        views.EmbeddableTopTasksWidget.as_view(),
        name="embeddable-top-tasks",
    ),
    path(
        "manual/lookup/",
        views.ManualScrobbleView.as_view(),
        name="lookup-manual-scrobble",
    ),
    path(
        "agent-session/<int:pk>/partial/",
        views.ScrobbleAgentSessionPartialView.as_view(),
        name="agent-session-partial",
    ),
    path(
        "agent-session/<int:pk>/follow-up/",
        views.AgentSessionFollowUpView.as_view(),
        name="agent-session-followup",
    ),
    path(
        "agent-session/<int:pk>/retry/",
        views.AgentSessionRetryView.as_view(),
        name="agent-session-retry",
    ),
    path(
        "long-play-finish/<slug:media_uuid>/",
        views.scrobble_longplay_finish,
        name="longplay-finish",
    ),
    path(
        "upload/audioscrobbler/",
        views.AudioScrobblerImportCreateView.as_view(),
        name="audioscrobbler-file-upload",
    ),
    path(
        "upload/koreader/",
        views.KoReaderImportCreateView.as_view(),
        name="koreader-file-upload",
    ),
    path(
        "upload/scale/",
        views.ScaleCSVImportCreateView.as_view(),
        name="scale-csv-upload",
    ),
    path(
        "upload/trail-gpx/",
        views.TrailGPXImportCreateView.as_view(),
        name="trail-gpx-upload",
    ),
    path(
        "lastfm-import/",
        views.lastfm_import,
        name="lastfm-import",
    ),
    path(
        "webhook/web-scrobbler/",
        views.WebScrobblerWebhookView.as_view(),
        name="web-scrobbler-webhook",
    ),
    path(
        "webhook/gps/",
        views.GPSWebhookView.as_view(),
        name="gps-webhook",
    ),
    path(
        "webhook/jellyfin/",
        views.JellyfinWebhookView.as_view(),
        name="jellyfin-webhook",
    ),
    path(
        "webhook/mopidy/",
        views.MopidyWebhookView.as_view(),
        name="mopidy-webhook",
    ),
    path("webhook/todoist/", TodoistWebhookView.as_view(), name="todoist-webhook"),
    path("webhook/emacs/", EmacsWebhookView.as_view(), name="emacs_webhook"),
    path("export/", views.export, name="export"),
    path(
        "imports/",
        views.ScrobbleImportListView.as_view(),
        name="import-detail",
    ),
    path("export/", views.export, name="export"),
    path(
        "imports/",
        views.ScrobbleImportListView.as_view(),
        name="import-detail",
    ),
    path(
        "imports/tsv/<slug:slug>/",
        views.ScrobbleTSVImportDetailView.as_view(),
        name="tsv-import-detail",
    ),
    path(
        "imports/lastfm/<slug:slug>/",
        views.ScrobbleLastFMImportDetailView.as_view(),
        name="lastfm-import-detail",
    ),
    path(
        "imports/koreader/<slug:slug>/",
        views.ScrobbleKoReaderImportDetailView.as_view(),
        name="koreader-import-detail",
    ),
    path(
        "imports/retroarch/<slug:slug>/",
        views.ScrobbleRetroarchImportDetailView.as_view(),
        name="retroarch-import-detail",
    ),
    path(
        "imports/bgstats/<slug:slug>/",
        views.ScrobbleBGStatsImportDetailView.as_view(),
        name="bgstats-import-detail",
    ),
    path(
        "imports/scale/<slug:slug>/",
        views.ScrobbleScaleCSVImportDetailView.as_view(),
        name="scale-csv-import-detail",
    ),
    path(
        "imports/trail-gpx/<slug:slug>/",
        views.ScrobbleTrailGPXImportDetailView.as_view(),
        name="trail-gpx-import-detail",
    ),
    path(
        "imports/ebird-csv/<slug:slug>/",
        views.ScrobbleBirdingCSVImportDetailView.as_view(),
        name="ebird-csv-import-detail",
    ),
    path(
        "imports/udisc-csv/<slug:slug>/",
        views.ScrobbleUDiscCSVImportDetailView.as_view(),
        name="udisc-csv-import-detail",
    ),
    path(
        "long-plays/",
        views.ScrobbleLongPlaysView.as_view(),
        name="long-plays",
    ),
    path("scrobbles/", views.ScrobbleListView.as_view(), name="scrobble-list"),
    path("blog/<str:username>/", views.ScrobbleBlogView.as_view(), name="blog"),
    path("explore/", views.ScrobbleExploreView.as_view(), name="explore"),
    path(
        "shared/<str:sqid>/",
        views.ScrobbleShareView.as_view(),
        name="shared-detail",
    ),
    path(
        "scrobbles/<int:pk>/",
        views.ScrobbleDetailView.as_view(),
        name="detail",
    ),
    path(
        "scrobbles/<int:pk>/regenerate-share-token/",
        views.RegenerateShareTokenView.as_view(),
        name="regenerate-share-token",
    ),
    path(
        "scrobbles/<int:pk>/change-visibility/",
        views.ChangeVisibilityView.as_view(),
        name="change-visibility",
    ),
    path(
        "scrobbles/<int:pk>/share-analytics/",
        views.ScrobbleShareAnalyticsView.as_view(),
        name="share-analytics",
    ),
    path(
        "scrobbles/<int:pk>/add-to-mopidy-queue/",
        views.add_to_mopidy_queue,
        name="add-to-mopidy-queue",
    ),
    path(
        "scrobbles/<int:pk>/add-to-mopidy-monthly-playlist/",
        views.add_to_mopidy_monthly_playlist,
        name="add-to-mopidy-monthly-playlist",
    ),
    path("scrobbles/<slug:media_uuid>/start/", views.scrobble_start, name="start"),
    path("scrobbles/<int:pk>/finish/", views.scrobble_finish, name="finish"),
    path("scrobbles/<int:pk>/cancel/", views.scrobble_cancel, name="cancel"),
    path(
        "favorite/<str:media_type>/<int:object_id>/toggle/",
        views.toggle_favorite,
        name="toggle-favorite",
    ),
]
