# Path: netvisor/schemas/fields.py
# class Boolean(fields.Boolean):
#     def __init__(self, true, false, **kwargs):
#         super(Boolean, self).__init__(**kwargs)
#         self.truthy = [true]
#         self.falsy = [false]
# 
#     def _serialize(self, value, attr, obj):
#         if value:
#             return self.truthy[0]
#         else:
#             return self.falsy[0]
# 
# 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 Boolean, List
# -*- coding: utf-8 -*-
"""
    netvisor.schemas.companies.list
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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



class CompanySchema(Schema):
    id = fields.Integer()
    name = fields.String()
    finnish_organization_identifier = fields.String(allow_none=True)
    is_active = Boolean(true='1', false='0')


class CompanyListSchema(Schema):

# Path: netvisor/schemas/fields.py
# class Boolean(fields.Boolean):
#     def __init__(self, true, false, **kwargs):
#         super(Boolean, self).__init__(**kwargs)
#         self.truthy = [true]
#         self.falsy = [false]
# 
#     def _serialize(self, value, attr, obj):
#         if value:
#             return self.truthy[0]
#         else:
#             return self.falsy[0]
# 
# 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/list.py
from marshmallow import Schema, fields, post_load
from ..fields import Boolean, List

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

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



class CompanySchema(Schema):
    id = fields.Integer()
    name = fields.String()
    finnish_organization_identifier = fields.String(allow_none=True)
    is_active = Boolean(true='1', false='0')


class CompanyListSchema(Schema):

    companies = List(