# Path: netvisor/schemas/common.py
# class DateSchema(FlattenElementSchema):
#     text = fields.Date(load_from='#text')
# 
# class StringSchema(FlattenElementSchema):
#     text = fields.String(load_from='#text')
# 
# Path: netvisor/schemas/fields.py
# class List(fields.List):
#     def _deserialize(self, value, attr, data):
#         if not is_collection(value) and value is not None:
#             value = [value]
#         return super(List, self)._deserialize(value, attr, data)


from marshmallow import Schema, fields, post_load
from ..common import DateSchema, StringSchema
from ..fields import List
# -*- coding: utf-8 -*-
"""
    netvisor.schemas.companies.get
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    :copyright: (c) 2013-2016 by Fast Monkeys Oy.
    :license: MIT, see LICENSE for more details.
"""



class Address(Schema):
    street = fields.String(allow_none=True)
    postal_code = fields.String()
    postal_office = fields.String()


class RegisteredName(Schema):
    type = fields.String()
    name = fields.String()
    current_activity_status = fields.String()
    established_date = fields.Nested(DateSchema)
    terminated_date = fields.Nested(DateSchema)


class RegisteredNames(Schema):

# Path: netvisor/schemas/common.py
# class DateSchema(FlattenElementSchema):
#     text = fields.Date(load_from='#text')
# 
# class StringSchema(FlattenElementSchema):
#     text = fields.String(load_from='#text')
# 
# Path: netvisor/schemas/fields.py
# class List(fields.List):
#     def _deserialize(self, value, attr, data):
#         if not is_collection(value) and value is not None:
#             value = [value]
#         return super(List, self)._deserialize(value, attr, data)


# Path: netvisor/schemas/companies/get.py
from marshmallow import Schema, fields, post_load
from ..common import DateSchema, StringSchema
from ..fields import List

# -*- coding: utf-8 -*-
"""
    netvisor.schemas.companies.get
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    :copyright: (c) 2013-2016 by Fast Monkeys Oy.
    :license: MIT, see LICENSE for more details.
"""



class Address(Schema):
    street = fields.String(allow_none=True)
    postal_code = fields.String()
    postal_office = fields.String()


class RegisteredName(Schema):
    type = fields.String()
    name = fields.String()
    current_activity_status = fields.String()
    established_date = fields.Nested(DateSchema)
    terminated_date = fields.Nested(DateSchema)


class RegisteredNames(Schema):

    registered_name = List(fields.Nested(RegisteredName))