# Path: shared_schema_tenants/exceptions.py
# class TenantFieldTypeConfigurationError(Exception):
# 
#     def __init__(self, message="The field is not configured correctly", errors=[]):
#         super(TenantFieldTypeConfigurationError, self).__init__(message)
# 
# Path: shared_schema_tenants/helpers/tenants.py
# def get_current_tenant():
#     from shared_schema_tenants.middleware import TenantMiddleware
#     return TenantMiddleware.get_current_tenant()


import sys
from django.core.exceptions import ValidationError
from django.utils.text import ugettext_lazy as _
from shared_schema_tenants.exceptions import TenantFieldTypeConfigurationError
from shared_schema_tenants.helpers.tenants import get_current_tenant


class TenantJSONFieldHelper(object):
    TYPES_TO_INTERNAL_MAP = {
        'string': [str],
        'number': [int, float],
        'boolean': [bool],
        'list': [list],
        'object': [dict],
    }

    def __init__(self, instance_field_name, instance=None,
                 tenant_fields={}, tenant_default_fields_values={}):
        if not instance:
            instance = get_current_tenant()

        self.instance = instance
        self.instance_field_name = instance_field_name

# Path: shared_schema_tenants/exceptions.py
# class TenantFieldTypeConfigurationError(Exception):
# 
#     def __init__(self, message="The field is not configured correctly", errors=[]):
#         super(TenantFieldTypeConfigurationError, self).__init__(message)
# 
# Path: shared_schema_tenants/helpers/tenants.py
# def get_current_tenant():
#     from shared_schema_tenants.middleware import TenantMiddleware
#     return TenantMiddleware.get_current_tenant()


# Path: shared_schema_tenants/helpers/tenant_json_field.py
import sys
from django.core.exceptions import ValidationError
from django.utils.text import ugettext_lazy as _
from shared_schema_tenants.exceptions import TenantFieldTypeConfigurationError
from shared_schema_tenants.helpers.tenants import get_current_tenant



class TenantJSONFieldHelper(object):
    TYPES_TO_INTERNAL_MAP = {
        'string': [str],
        'number': [int, float],
        'boolean': [bool],
        'list': [list],
        'object': [dict],
    }

    def __init__(self, instance_field_name, instance=None,
                 tenant_fields={}, tenant_default_fields_values={}):
        if not instance:
            instance = get_current_tenant()

        self.instance = instance
        self.instance_field_name = instance_field_name

        self.tenant = get_current_tenant()