from django.shortcuts import render
from django.http import JsonResponse
from .models import HeroSection
# Create your views here.
def hero_api(request):
    hero = HeroSection.objects.first();
    if hero:
        data = {
            "video_url": hero.video_url,
            "thumbnail_image": request.build_absolute_uri(hero.thumbnail_image.url)
        }
    else:
        data = {
            "video_url": "",
            "thumbnail_image": ""
        }
    return JsonResponse(data)