# Path: prestans/exception.py
# class Base(Exception):
# class UnsupportedVocabularyError(Base):
# class UnsupportedContentTypeError(Base):
# class ValidationError(Base):
# class HandlerException(Base):
# class RequestException(HandlerException):
# class ResponseException(HandlerException):
# class UnimplementedVerbError(RequestException):
# class NoEndpointError(RequestException):
# class AuthenticationError(RequestException):
# class AuthorizationError(RequestException):
# class SerializationFailedError(RequestException):
# class DeSerializationFailedError(RequestException):
# class AttributeFilterDiffers(RequestException):
# class InconsistentPersistentDataError(Base):
# class DataValidationException(Base):
# class RequiredAttributeError(DataValidationException):
# class ParseFailedError(DataValidationException):
# class LessThanMinimumError(DataValidationException):
# class MoreThanMaximumError(DataValidationException):
# class InvalidChoiceError(DataValidationException):
# class MinimumLengthError(DataValidationException):
# class MaximumLengthError(DataValidationException):
# class InvalidTypeError(DataValidationException):
# class MissingParameterError(DataValidationException):
# class InvalidFormatError(DataValidationException):
# class InvalidMetaValueError(DataValidationException):
# class UnregisteredAdapterError(DataValidationException):
# class ServiceUnavailable(ResponseException):
# class BadRequest(ResponseException):
# class Conflict(ResponseException):
# class NotFound(ResponseException):
# class Unauthorized(ResponseException):
# class MovedPermanently(ResponseException):
# class Redirect(ResponseException):
# class TemporaryRedirect(Redirect):
# class PermanentRedirect(Redirect):
# class PaymentRequired(ResponseException):
# class Forbidden(ResponseException):
# class InternalServerError(ResponseException):
#     def __init__(self, http_status, message):
#     def http_status(self):
#     def http_status(self, value):
#     def stack_trace(self):
#     def push_trace(self, trace_object):
#     def message(self):
#     def __str__(self):
#     def __init__(self, accept_header, supported_types):
#     def __init__(self, requested_mime_type, content_type):
#     def __init__(self, message, attribute_name, value, blueprint):
#     def append_validation_trace(self, blueprint):
#     def __str__(self):
#     def __init__(self, code, message):
#     def request(self):
#     def request(self, value):
#     def log_message(self):
#     def __str__(self):
#     def __init__(self, code, message):
#     def __init__(self, code, message, response_model=None):
#     def response_model(self):
#     def __init__(self, verb_name):
#     def __init__(self):
#     def __init__(self, message=None):
#     def __init__(self, role_name):
#     def __init__(self, format):
#     def __init__(self, format):
#     def __init__(self, attribute_list):
#     def __init__(self, attribute_name, exception_message):
#     def __str__(self):
#     def __init__(self, message):
#     def __init__(self):
#     def __init__(self, message="Parser Failed"):
#     def __init__(self, value, allowed_min):
#     def __init__(self, value, allowed_max):
#     def __init__(self, value, allowed_choices):
#     def __init__(self, value, minimum):
#     def __init__(self, value, maximum):
#     def __init__(self, value, type_name):
#     def __init__(self):
#     def __init__(self, value):
#     def __init__(self):
#     def __init__(self, model_name):
#     def __init__(self, message="Service Unavailable", response_model=None):
#     def __init__(self, message="Bad Request", response_model=None):
#     def __init__(self, message="Conflict", response_model=None):
#     def __init__(self, message="Not Found", response_model=None):
#     def __init__(self, message="Unauthorized", response_model=None):
#     def __init__(self, message="Moved Permanently", response_model=None):
#     def __init__(self, code, url):
#     def url(self):
#     def __init__(self, url):
#     def __init__(self, url):
#     def __init__(self, message="Payment Required", response_model=None):
#     def __init__(self, message="Forbidden", response_model=None):
#     def __init__(self, message="Internal Server Error", response_model=None):
# 
# Path: prestans/types/base.py
# class DataStructure(DataType):
#     """
#     Wrappers on Python types generally represented as structures e.g DateTime
# 
#     as_serializable methods signature for %DataStructure is different to that of DataCollection
#     it requires a value to be passed in, this is because the python type of structures is
#     difference to what gets serialized.
# 
#     E.g DateTime serializes itself as a ISO string
#     """
# 
#     def blueprint(self):
#         raise NotImplementedError
# 
#     def validate(self, value):
#         raise NotImplementedError
# 
#     def as_serializable(self, value):
#         raise NotImplementedError


from datetime import datetime as datetime_type
from datetime import datetime
from prestans import exception
from prestans.types import DataStructure
        from prestans.util import string_types
#  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
#  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#



class DateTime(DataStructure):

    DEFAULT_FORMAT = "%Y-%m-%d %H:%M:%S"
    NOW = '_PRESTANS_CONSTANT_MODEL_DATETIME_NOW'
    UTC_NOW = '_PRESTANS_CONSTANT_MODEL_DATETIME_UTC_NOW'

    def __init__(self, default=None, required=True, format=DEFAULT_FORMAT,
                 timezone=False, utc=False, description=None):

        if isinstance(default, datetime_type) or \
                default == self.NOW or \
                default == self.UTC_NOW or \
                default is None:
            self._default = default
        else:
            raise TypeError("default must be one of datetime, DateTime.NOW or DateTime.UTC_NOW")

        self._required = required
        self._timezone = timezone
        self._utc = utc
        self._format = format
        self._description = description

    @property

# Path: prestans/exception.py
# class Base(Exception):
# class UnsupportedVocabularyError(Base):
# class UnsupportedContentTypeError(Base):
# class ValidationError(Base):
# class HandlerException(Base):
# class RequestException(HandlerException):
# class ResponseException(HandlerException):
# class UnimplementedVerbError(RequestException):
# class NoEndpointError(RequestException):
# class AuthenticationError(RequestException):
# class AuthorizationError(RequestException):
# class SerializationFailedError(RequestException):
# class DeSerializationFailedError(RequestException):
# class AttributeFilterDiffers(RequestException):
# class InconsistentPersistentDataError(Base):
# class DataValidationException(Base):
# class RequiredAttributeError(DataValidationException):
# class ParseFailedError(DataValidationException):
# class LessThanMinimumError(DataValidationException):
# class MoreThanMaximumError(DataValidationException):
# class InvalidChoiceError(DataValidationException):
# class MinimumLengthError(DataValidationException):
# class MaximumLengthError(DataValidationException):
# class InvalidTypeError(DataValidationException):
# class MissingParameterError(DataValidationException):
# class InvalidFormatError(DataValidationException):
# class InvalidMetaValueError(DataValidationException):
# class UnregisteredAdapterError(DataValidationException):
# class ServiceUnavailable(ResponseException):
# class BadRequest(ResponseException):
# class Conflict(ResponseException):
# class NotFound(ResponseException):
# class Unauthorized(ResponseException):
# class MovedPermanently(ResponseException):
# class Redirect(ResponseException):
# class TemporaryRedirect(Redirect):
# class PermanentRedirect(Redirect):
# class PaymentRequired(ResponseException):
# class Forbidden(ResponseException):
# class InternalServerError(ResponseException):
#     def __init__(self, http_status, message):
#     def http_status(self):
#     def http_status(self, value):
#     def stack_trace(self):
#     def push_trace(self, trace_object):
#     def message(self):
#     def __str__(self):
#     def __init__(self, accept_header, supported_types):
#     def __init__(self, requested_mime_type, content_type):
#     def __init__(self, message, attribute_name, value, blueprint):
#     def append_validation_trace(self, blueprint):
#     def __str__(self):
#     def __init__(self, code, message):
#     def request(self):
#     def request(self, value):
#     def log_message(self):
#     def __str__(self):
#     def __init__(self, code, message):
#     def __init__(self, code, message, response_model=None):
#     def response_model(self):
#     def __init__(self, verb_name):
#     def __init__(self):
#     def __init__(self, message=None):
#     def __init__(self, role_name):
#     def __init__(self, format):
#     def __init__(self, format):
#     def __init__(self, attribute_list):
#     def __init__(self, attribute_name, exception_message):
#     def __str__(self):
#     def __init__(self, message):
#     def __init__(self):
#     def __init__(self, message="Parser Failed"):
#     def __init__(self, value, allowed_min):
#     def __init__(self, value, allowed_max):
#     def __init__(self, value, allowed_choices):
#     def __init__(self, value, minimum):
#     def __init__(self, value, maximum):
#     def __init__(self, value, type_name):
#     def __init__(self):
#     def __init__(self, value):
#     def __init__(self):
#     def __init__(self, model_name):
#     def __init__(self, message="Service Unavailable", response_model=None):
#     def __init__(self, message="Bad Request", response_model=None):
#     def __init__(self, message="Conflict", response_model=None):
#     def __init__(self, message="Not Found", response_model=None):
#     def __init__(self, message="Unauthorized", response_model=None):
#     def __init__(self, message="Moved Permanently", response_model=None):
#     def __init__(self, code, url):
#     def url(self):
#     def __init__(self, url):
#     def __init__(self, url):
#     def __init__(self, message="Payment Required", response_model=None):
#     def __init__(self, message="Forbidden", response_model=None):
#     def __init__(self, message="Internal Server Error", response_model=None):
# 
# Path: prestans/types/base.py
# class DataStructure(DataType):
#     """
#     Wrappers on Python types generally represented as structures e.g DateTime
# 
#     as_serializable methods signature for %DataStructure is different to that of DataCollection
#     it requires a value to be passed in, this is because the python type of structures is
#     difference to what gets serialized.
# 
#     E.g DateTime serializes itself as a ISO string
#     """
# 
#     def blueprint(self):
#         raise NotImplementedError
# 
#     def validate(self, value):
#         raise NotImplementedError
# 
#     def as_serializable(self, value):
#         raise NotImplementedError


# Path: prestans/types/datetime_prestans.py
from datetime import datetime as datetime_type
from datetime import datetime
from prestans import exception
from prestans.types import DataStructure
        from prestans.util import string_types

#  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
#  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#



class DateTime(DataStructure):

    DEFAULT_FORMAT = "%Y-%m-%d %H:%M:%S"
    NOW = '_PRESTANS_CONSTANT_MODEL_DATETIME_NOW'
    UTC_NOW = '_PRESTANS_CONSTANT_MODEL_DATETIME_UTC_NOW'

    def __init__(self, default=None, required=True, format=DEFAULT_FORMAT,
                 timezone=False, utc=False, description=None):

        if isinstance(default, datetime_type) or \
                default == self.NOW or \
                default == self.UTC_NOW or \
                default is None:
            self._default = default
        else:
            raise TypeError("default must be one of datetime, DateTime.NOW or DateTime.UTC_NOW")

        self._required = required
        self._timezone = timezone
        self._utc = utc
        self._format = format
        self._description = description

    @property

    def default(self):