from django.shortcuts import render
from ..models import SupportedResourceType
from collections import OrderedDict
from django.http import HttpResponse
import json
from django.views.decorators.csrf import csrf_exempt
from ..utils import (kickout_403, kickout_404)
from .utils import check_access_interaction_and_resource_type
@csrf_exempt
def delete(request, resource_type, id):
    """Delete FHIR Interaction"""
    # Example client use in curl:
    # curl -X DELETE -H "Content-Type: application/json" --data @test.json http://127.0.0.1:8000/fhir/Practitioner/12345 
    interaction_type = 'delete'
    #Check if this interaction type and resource type combo is allowed.
    deny = check_access_interaction_and_resource_type(resource_type, interaction_type)
    if deny:
        #If not allowed, return a 4xx error.
        return deny
    
    od = OrderedDict()
    od['request_method']= request.method
    od['interaction_type'] = interaction_type
    od['resource_type']    = resource_type
    od['id'] = id
    od['note'] = "This is only a stub for future implementation"
    return HttpResponse(json.dumps(od, indent=4),
                        content_type="application/json")
@@ -319,16 +319,54 @@
 ce_type%0A
+%0Afrom ..settings import FHIR_BACKEND%0A%0A
 @csrf_ex
@@ -869,16 +869,106 @@
 rn deny%0A
+%0A    #testing direct response%0A    return FHIR_BACKEND.delete(request, resource_type, id)%0A%0A
     %0A   

implement delete pass through api