# -*- coding: utf-8 -*-

# This file is part of wger Workout Manager.
#
# wger Workout Manager is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# wger Workout Manager is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with Workout Manager.  If not, see <http://www.gnu.org/licenses/>.

# Django
from django.conf.urls import (
    include,
    url,
)
from django.urls import path
from django.views.generic import TemplateView

# wger
from wger.exercises.views import (
    categories,
    comments,
    equipment,
    exercises,
    history,
    images,
    muscles,
)


# sub patterns for history
patterns_history = [
    path('overview/', history.overview, name='overview'),
    path('overview-history/', history.overview2, name='overview-history'),
]

# sub patterns for muscles
patterns_muscle = [
    path(
        'admin-overview/',
        muscles.MuscleAdminListView.as_view(),
        name='admin-list',
    ),
    path(
        'add/',
        muscles.MuscleAddView.as_view(),
        name='add',
    ),
    path(
        '<int:pk>/edit/',
        muscles.MuscleUpdateView.as_view(),
        name='edit',
    ),
    path(
        '<int:pk>/delete/',
        muscles.MuscleDeleteView.as_view(),
        name='delete',
    ),
]

# sub patterns for exercise images
patterns_images = [
    path(
        '<int:exercise_pk>/image/add',
        images.ExerciseImageAddView.as_view(),
        name='add',
    ),
    path(
        '<int:pk>/edit',
        images.ExerciseImageEditView.as_view(),
        name='edit',
    ),
    path(
        '<int:exercise_pk>/image/<int:pk>/delete',
        images.ExerciseImageDeleteView.as_view(),
        name='delete',
    ),
    path(
        '<int:pk>/accept/',
        images.accept,
        name='accept',
    ),
    path(
        '<int:pk>/decline/',
        images.decline,
        name='decline',
    ),
]


# sub patterns for exercise comments
patterns_comment = [
    path(
        '<int:exercise_pk>/comment/add/',
        comments.ExerciseCommentAddView.as_view(),
        name='add',
    ),
    path(
        '<int:pk>/edit/',
        comments.ExerciseCommentEditView.as_view(),
        name='edit',
    ),
    path(
        '<int:id>/delete/',
        comments.delete,
        name='delete',
    ),
]

# sub patterns for categories
patterns_category = [
    path(
        'list',
        categories.ExerciseCategoryListView.as_view(),
        name='list',
    ),
    path(
        '<int:pk>/edit/',
        categories.ExerciseCategoryUpdateView.as_view(),
        name='edit',
    ),
    path(
        'add/',
        categories.ExerciseCategoryAddView.as_view(),
        name='add',
    ),
    path(
        '<int:pk>/delete/',
        categories.ExerciseCategoryDeleteView.as_view(),
        name='delete',
    ),
]

# sub patterns for equipment
patterns_equipment = [
    path(
        'list',
        equipment.EquipmentListView.as_view(),
        name='list',
    ),
    path(
        'add',
        equipment.EquipmentAddView.as_view(),
        name='add',
    ),
    path(
        '<int:pk>/edit',
        equipment.EquipmentEditView.as_view(),
        name='edit',
    ),
    path(
        '<int:pk>/delete',
        equipment.EquipmentDeleteView.as_view(),
        name='delete',
    ),
]

# sub patterns for exercises
patterns_exercise = [
    path(
        'overview/',
        exercises.ExerciseListView.as_view(),
        name='overview',
    ),
    path(
        '<int:id>/view/',
        exercises.view,
        name='view',
    ),
    url(
        r'^(?P<id>\d+)/view/(?P<slug>[-\w]*)/?$',
        exercises.view,
        name='view',
    ),
    path(
        '<int:id>/view-base',
        TemplateView.as_view(template_name='exercise/view-base.html'),
        name='view-base',
    ),
    path(
        '<int:pk>/delete/',
        exercises.ExerciseDeleteView.as_view(),
        name='delete',
    ),
]

urlpatterns = [
    path('muscle/', include((patterns_muscle, 'muscle'), namespace="muscle")),
    path('image/', include((patterns_images, 'image'), namespace="image")),
    path('comment/', include((patterns_comment, 'comment'), namespace="comment")),
    path('category/', include((patterns_category, 'category'), namespace="category")),
    path('equipment/', include((patterns_equipment, 'equipment'), namespace="equipment")),
    path('history/', include((patterns_history, 'history'), namespace="history")),
    path('', include((patterns_exercise, 'exercise'), namespace="exercise")),
]

@@ -992,20 +992,8 @@
 ry,%0A
-    images,%0A
     
@@ -1675,626 +1675,8 @@
 %0A%5D%0A%0A
-# sub patterns for exercise images%0Apatterns_images = %5B%0A    path(%0A        '%3Cint:exercise_pk%3E/image/add',%0A        images.ExerciseImageAddView.as_view(),%0A        name='add',%0A    ),%0A    path(%0A        '%3Cint:pk%3E/edit',%0A        images.ExerciseImageEditView.as_view(),%0A        name='edit',%0A    ),%0A    path(%0A        '%3Cint:exercise_pk%3E/image/%3Cint:pk%3E/delete',%0A        images.ExerciseImageDeleteView.as_view(),%0A        name='delete',%0A    ),%0A    path(%0A        '%3Cint:pk%3E/accept/',%0A        images.accept,%0A        name='accept',%0A    ),%0A    path(%0A        '%3Cint:pk%3E/decline/',%0A        images.decline,%0A        name='decline',%0A    ),%0A%5D%0A%0A
 %0A# s
@@ -3790,84 +3790,8 @@
 )),%0A
-    path('image/', include((patterns_images, 'image'), namespace=%22image%22)),%0A
     

Fix merge conflicts