# Path: launchkey/utils/validation.py
# class ValidateISODate(FancyValidator):
#     """Validator for LaunchKey ISO dates"""
# 
#     @staticmethod
#     def _to_python(value, state):
#         try:
#             val = parse(value)
#         except ValueError:
#             raise Invalid("Date/time format is invalid, it must be ISO 8601 "
#                           "formatted  for UTZ with no offset (i.e. "
#                           "2010-01-01T01:01:01Z)", value, state) from None
#         return val


from formencode import Schema, validators, ForEach
from ..utils.validation import ValidateISODate
    """Public Key entity Validator"""
    id = validators.String()
    active = validators.Bool()
    date_created = ValidateISODate()
    date_expires = ValidateISODate()
    public_key = validators.String()
    key_type = validators.Int(if_missing=0, if_empty=0)
    allow_extra_fields = True


class DirectoryUserDeviceLinkResponseValidator(Schema):
    """Directory User Device link response validator"""
    qrcode = validators.String()  # URL
    code = validators.String(min=7)
    device_id = validators.String()
    allow_extra_fields = True


class DirectoryGetDeviceResponseValidator(Schema):
    """Directory get Device response validator"""
    id = validators.String()
    name = validators.String()
    status = validators.Int()
    type = validators.String()
    allow_extra_fields = True


class DirectoryGetSessionsValidator(Schema):
    """Directory get Sessions validator"""
    auth_request = validators.String()

# Path: launchkey/utils/validation.py
# class ValidateISODate(FancyValidator):
#     """Validator for LaunchKey ISO dates"""
# 
#     @staticmethod
#     def _to_python(value, state):
#         try:
#             val = parse(value)
#         except ValueError:
#             raise Invalid("Date/time format is invalid, it must be ISO 8601 "
#                           "formatted  for UTZ with no offset (i.e. "
#                           "2010-01-01T01:01:01Z)", value, state) from None
#         return val


# Path: launchkey/entities/validation.py
from formencode import Schema, validators, ForEach
from ..utils.validation import ValidateISODate

    """Public Key entity Validator"""
    id = validators.String()
    active = validators.Bool()
    date_created = ValidateISODate()
    date_expires = ValidateISODate()
    public_key = validators.String()
    key_type = validators.Int(if_missing=0, if_empty=0)
    allow_extra_fields = True


class DirectoryUserDeviceLinkResponseValidator(Schema):
    """Directory User Device link response validator"""
    qrcode = validators.String()  # URL
    code = validators.String(min=7)
    device_id = validators.String()
    allow_extra_fields = True


class DirectoryGetDeviceResponseValidator(Schema):
    """Directory get Device response validator"""
    id = validators.String()
    name = validators.String()
    status = validators.Int()
    type = validators.String()
    allow_extra_fields = True


class DirectoryGetSessionsValidator(Schema):
    """Directory get Sessions validator"""
    auth_request = validators.String()

    date_created = ValidateISODate()