'Delete a Project
Schedules a project for deletion.
Deletion happens asynchronously and therefor is not immediate.
However once deletion has begun the state of a project changes and
will be hidden from most public views.
:pparam string organization_slug: the slug of the organization the
project belongs to.
:pparam string project_slug: the slug of the project to delete.
:auth: required'

@attach_scenarios([delete_project_scenario])
@sudo_required
def delete(self, request, project):

    if project.is_internal_project():
        return Response('{"error":    "Cannot    remove    projects    internally    used    by    Sentry."}', status=status.HTTP_403_FORBIDDEN)
    updated = Project.objects.filter(id=project.id, status=ProjectStatus.VISIBLE).update(status=ProjectStatus.PENDING_DELETION)
    if updated:
        transaction_id = uuid4().hex
        delete_project.apply_async(kwargs={'object_id': project.id, 'transaction_id': transaction_id}, countdown=3600)
        self.create_audit_entry(request=request, organization=project.organization, target_object=project.id, event=AuditLogEntryEvent.PROJECT_REMOVE, data=project.get_audit_log_data(), transaction_id=transaction_id)
        delete_logger.info('object.delete.queued', extra={'object_id': project.id, 'transaction_id': transaction_id, 'model': type(project).__name__})
    return Response(status=204)
