from django.contrib import admin
from django.urls import path, include
from drf_yasg.views import get_schema_view
from drf_yasg import openapi
from rest_framework import permissions
from rest_framework_simplejwt.views import TokenObtainPairView, TokenRefreshView


from API.views import custom_endpoint, CustomEndpointView, get_by_prod_id, obtener_datos_productor

schema_view = get_schema_view(
    openapi.Info(
        title="DATARI+ API",
        default_version='v1',
        description="API Privada",
        terms_of_service="https://datari.site",
        contact=openapi.Contact(email="contacto@datari.site"),
        license=openapi.License(name="Test License"),
    ),
    public=True,
    permission_classes=(permissions.AllowAny,),
)


urlpatterns = [
    path('accounts/', admin.site.urls),
    path('api-agro/',include('API.urls')),
    path('auth/',include('auth.urls')),
    path('productores/<int:prod_id>/home', get_by_prod_id, name='get_by_prod_id'),
    ## Se retira el file_management ya que no se cargaran proyectos
    # path('file_management/',include('upload_file.urls')),
    # path('', schema_view.with_ui(
    #     'swagger',cache_timeout=0), name='schema-swagger-ui'
    # ),
    path('api/api.json/', schema_view.with_ui(cache_timeout=0),
        name='schema-swagger-ui'
    ),
    path('',
        schema_view.with_ui('redoc',cache_timeout=0), name='schema-redoc'
    ),
    path('custom-endpoint/', custom_endpoint, name='custom_endpoint'),  # For function-based view
    path('custom-endpoint-class/', CustomEndpointView.as_view(), name='custom_endpoint_class'), 
    path('api/productores/<int:prod_id>/', obtener_datos_productor, name='obtener_datos_productor'),# For class-based view


]
