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

from django.shortcuts import render

from account.models import LensmanInfo, TourGuideInfo


def user_agreement(request):
    return render(request, 'page/user_agreement.html', {})


def contact_us(request):
    return render(request, 'page/contact_us.html', {})


def lensman_oauth(request):
    unionid = request.GET.get('unionid', '')

    try:
        lensman = LensmanInfo.objects.get(unionid=unionid)
    except LensmanInfo.DoesNotExist:
        lensman = None

    return render(request, 'page/lensman_oauth.html', {
        'lensman_info': lensman and lensman.data,
        'modified': bool((not lensman) or (lensman and lensman.user_status in [LensmanInfo.UNVERIFIED, LensmanInfo.REFUSED])),  # 是否可以更改信息
    })


def lensman_price(request):
    return render(request, 'page/lensman_price.html', {})


def tourguide_oauth(request):
    unionid = request.GET.get('unionid', '')

    try:
        tourguide = TourGuideInfo.objects.get(unionid=unionid)
    except TourGuideInfo.DoesNotExist:
        tourguide = None

    return render(request, 'page/tourguide_oauth.html', {
        'tourguide_info': tourguide and tourguide.data,
        'modified': bool((not tourguide) or (tourguide and tourguide.user_status in [TourGuideInfo.UNVERIFIED, TourGuideInfo.REFUSED])),  # 是否可以更改信息
    })
