from django.urls import reverse_lazy
from django.views.generic import TemplateView, RedirectView
from django.shortcuts import render


# Create your views here.
class IndexView(TemplateView):
    template_name = 'landing-page.html'
    extra_context = {
        'title': 'Home',
        'description': 'This is the home page of the container application.',
    }

    def get(self, request, *args, **kwargs):
        return render(request, self.template_name, self.extra_context)



class DashboardRedirectView(RedirectView):
    is_permanent = False

    def get_redirect_url(self, *args, **kwargs):
        # if self.request.user.is_authenticated:
            if self.request.user.username == 'client':
                return reverse_lazy('client_dashboard')
            elif self.request.user.username == 'clientadmin':
                return reverse_lazy('client_dashboard')
            elif self.request.user.username == 'barrier':
                return  reverse_lazy('barrier_dashboard')
            return  reverse_lazy('index')


class ClientDashboardView(TemplateView):
    template_name = 'client-dashboard-content.html'
    extra_context = {
        'title': 'Client Dashboard',
        'description': 'This is the client dashboard page.',
    }

    def get(self, request, *args, **kwargs):
        return render(request, self.template_name, self.extra_context)

class BarrierDashboardView(TemplateView):
    template_name = 'barrier-dashboard.html'
    extra_context = {
        'title': 'Client Dashboard',
        'description': 'This is the client dashboard page.',
    }

    def get(self, request, *args, **kwargs):
        return render(request, self.template_name, self.extra_context)



# class ClientPreinfoView(TemplateView):
#     template_name = 'client-preinfo-content.html'
#
#
#
#     def get(self, request, *args, **kwargs):
#         return render(request, self.template_name, self.extra_context)