# Path: esteid/actions.py
# class BaseAction(object):
#     @classmethod
#     def do_action(cls, view: "GenericDigitalSignViewMixin", params):
#         raise NotImplementedError
# 
# Path: esteid/types.py
# class DataFile:
#     def __init__(self, file_name, mimetype, content_type, size, content, info=None):
#         self.file_name = file_name
#         self.mimetype = mimetype
#         self.content_type = content_type
#         self.size = size
#         self.content = content
# 
#         self.info = info


import warnings
from typing import List
from django.http import HttpRequest, JsonResponse
from django.views import View
from .actions import BaseAction
from .types import DataFile

    def get_files(self) -> List[DataFile]:
        """
        This should be implemented on view level, and should return a list of files that should be digitally signed.

        Will be ignored if `get_bdoc_container_file()` returns not None
        """
        return []

    def get_bdoc_container_file(self) -> str:
        """
        Returns path to a container that should be digitally signed.

        If there is a container, then get_files() will be ignored, and a new signature will be added to the container.
        """
        pass


class ApiView(View):
    def dispatch(self, request, *args, **kwargs):
        response = super().dispatch(request, *args, **kwargs)
        if isinstance(response, (dict, list, tuple)):
            return JsonResponse(response)

        return response


class SignStatusViewMixin:
    """Gets the status of signing and finalizes the process if necessary."""


# Path: esteid/actions.py
# class BaseAction(object):
#     @classmethod
#     def do_action(cls, view: "GenericDigitalSignViewMixin", params):
#         raise NotImplementedError
# 
# Path: esteid/types.py
# class DataFile:
#     def __init__(self, file_name, mimetype, content_type, size, content, info=None):
#         self.file_name = file_name
#         self.mimetype = mimetype
#         self.content_type = content_type
#         self.size = size
#         self.content = content
# 
#         self.info = info


# Path: esteid/generic.py
import warnings
from typing import List
from django.http import HttpRequest, JsonResponse
from django.views import View
from .actions import BaseAction
from .types import DataFile


    def get_files(self) -> List[DataFile]:
        """
        This should be implemented on view level, and should return a list of files that should be digitally signed.

        Will be ignored if `get_bdoc_container_file()` returns not None
        """
        return []

    def get_bdoc_container_file(self) -> str:
        """
        Returns path to a container that should be digitally signed.

        If there is a container, then get_files() will be ignored, and a new signature will be added to the container.
        """
        pass


class ApiView(View):
    def dispatch(self, request, *args, **kwargs):
        response = super().dispatch(request, *args, **kwargs)
        if isinstance(response, (dict, list, tuple)):
            return JsonResponse(response)

        return response


class SignStatusViewMixin:
    """Gets the status of signing and finalizes the process if necessary."""


    ACTION_CLASS: BaseAction