# Path: netvisor/schemas/fields.py
# class Decimal(fields.Decimal):
#     def _deserialize(self, value, attr, data):
#         return super(Decimal, self)._deserialize(
#             value.replace(',', '.'),
#             attr,
#             data
#         )
# 
#     def serialize(self, attr, obj, accessor=None):
#         value = super(Decimal, self).serialize(attr, obj, accessor)
#         if value is missing:
#             return value
#         return str(value).replace('.', ',')
# 
# 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 Decimal, List
# -*- coding: utf-8 -*-
"""
    netvisor.schemas.products.list
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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



class ProductSchema(Schema):
    netvisor_key = fields.Integer()
    name = fields.String()
    product_code = fields.String(allow_none=True)

# Path: netvisor/schemas/fields.py
# class Decimal(fields.Decimal):
#     def _deserialize(self, value, attr, data):
#         return super(Decimal, self)._deserialize(
#             value.replace(',', '.'),
#             attr,
#             data
#         )
# 
#     def serialize(self, attr, obj, accessor=None):
#         value = super(Decimal, self).serialize(attr, obj, accessor)
#         if value is missing:
#             return value
#         return str(value).replace('.', ',')
# 
# 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/products/list.py
from marshmallow import Schema, fields, post_load
from ..fields import Decimal, List

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

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



class ProductSchema(Schema):
    netvisor_key = fields.Integer()
    name = fields.String()
    product_code = fields.String(allow_none=True)

    unit_price = Decimal()