from django.http import JsonResponse
import json
import os

STATE_CITY_FILE = os.path.join(os.path.dirname(__file__), './state-city.json')
with open(STATE_CITY_FILE, 'r') as f:
    state_city_data = json.load(f)

def get_cities(request):
    state = request.GET.get('state')
    cities = state_city_data.get(state, [])
    return JsonResponse({'cities': cities})
