# 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 ..fields import List
# -*- coding: utf-8 -*-
"""
    netvisor.schemas.customers.list
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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



class CustomerSchema(Schema):
    netvisor_key = fields.Integer(load_from='netvisorkey', required=True)
    name = fields.String(required=True)
    code = fields.String(allow_none=True, required=True)
    organisation_identifier = fields.String(allow_none=True, required=True)


class CustomerListSchema(Schema):

# 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/customers/list.py
from marshmallow import Schema, fields, post_load
from ..fields import List

# -*- coding: utf-8 -*-
"""
    netvisor.schemas.customers.list
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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



class CustomerSchema(Schema):
    netvisor_key = fields.Integer(load_from='netvisorkey', required=True)
    name = fields.String(required=True)
    code = fields.String(allow_none=True, required=True)
    organisation_identifier = fields.String(allow_none=True, required=True)


class CustomerListSchema(Schema):

    customers = List(