# Path: marathon/exceptions.py
# class InvalidChoiceError(MarathonError):
# 
#     def __init__(self, param, value, options):
#         super().__init__(
#             'Invalid choice "{value}" for param "{param}". Must be one of {options}'.format(
#                 param=param, value=value, options=options
#             )
#         )
# 
# Path: marathon/models/base.py
# class MarathonObject:
#     """Base Marathon object."""
# 
#     def __repr__(self):
#         return "{clazz}::{obj}".format(clazz=self.__class__.__name__, obj=self.to_json(minimal=False))
# 
#     def __eq__(self, other):
#         try:
#             return self.__dict__ == other.__dict__
#         except Exception:
#             return False
# 
#     def __hash__(self):
#         # Technically this class shouldn't be hashable because it often
#         # contains mutable fields, but in practice this class is used more
#         # like a record or namedtuple.
#         return hash(self.to_json())
# 
#     def json_repr(self, minimal=False):
#         """Construct a JSON-friendly representation of the object.
# 
#         :param bool minimal: Construct a minimal representation of the object (ignore nulls and empty collections)
# 
#         :rtype: dict
#         """
#         if minimal:
#             return {to_camel_case(k): v for k, v in vars(self).items() if (v or v is False or v == 0)}
#         else:
#             return {to_camel_case(k): v for k, v in vars(self).items()}
# 
#     @classmethod
#     def from_json(cls, attributes):
#         """Construct an object from a parsed response.
# 
#         :param dict attributes: object attributes from parsed response
#         """
#         return cls(**{to_snake_case(k): v for k, v in attributes.items()})
# 
#     def to_json(self, minimal=True):
#         """Encode an object as a JSON string.
# 
#         :param bool minimal: Construct a minimal representation of the object (ignore nulls and empty collections)
# 
#         :rtype: str
#         """
#         if minimal:
#             return json.dumps(self.json_repr(minimal=True), cls=MarathonMinimalJsonEncoder, sort_keys=True)
#         else:
#             return json.dumps(self.json_repr(), cls=MarathonJsonEncoder, sort_keys=True)


from ..exceptions import InvalidChoiceError
from .base import MarathonObject
    """

    TYPES = ['DOCKER', 'MESOS']
    """Valid container types"""

    def __init__(self, docker=None, type='DOCKER', port_mappings=None, volumes=None):
        if type not in self.TYPES:
            raise InvalidChoiceError('type', type, self.TYPES)
        self.type = type

        # Marathon v1.5 moved portMappings from within container.docker object directly
        # under the container object
        if port_mappings:
            self.port_mappings = [
                pm if isinstance(
                    pm, MarathonContainerPortMapping) else MarathonContainerPortMapping().from_json(pm)
                for pm in (port_mappings or [])
            ]

        if docker:
            self.docker = docker if isinstance(docker, MarathonDockerContainer) \
                else MarathonDockerContainer().from_json(docker)

        self.volumes = [
            v if isinstance(
                v, MarathonContainerVolume) else MarathonContainerVolume().from_json(v)
            for v in (volumes or [])
        ]



# Path: marathon/exceptions.py
# class InvalidChoiceError(MarathonError):
# 
#     def __init__(self, param, value, options):
#         super().__init__(
#             'Invalid choice "{value}" for param "{param}". Must be one of {options}'.format(
#                 param=param, value=value, options=options
#             )
#         )
# 
# Path: marathon/models/base.py
# class MarathonObject:
#     """Base Marathon object."""
# 
#     def __repr__(self):
#         return "{clazz}::{obj}".format(clazz=self.__class__.__name__, obj=self.to_json(minimal=False))
# 
#     def __eq__(self, other):
#         try:
#             return self.__dict__ == other.__dict__
#         except Exception:
#             return False
# 
#     def __hash__(self):
#         # Technically this class shouldn't be hashable because it often
#         # contains mutable fields, but in practice this class is used more
#         # like a record or namedtuple.
#         return hash(self.to_json())
# 
#     def json_repr(self, minimal=False):
#         """Construct a JSON-friendly representation of the object.
# 
#         :param bool minimal: Construct a minimal representation of the object (ignore nulls and empty collections)
# 
#         :rtype: dict
#         """
#         if minimal:
#             return {to_camel_case(k): v for k, v in vars(self).items() if (v or v is False or v == 0)}
#         else:
#             return {to_camel_case(k): v for k, v in vars(self).items()}
# 
#     @classmethod
#     def from_json(cls, attributes):
#         """Construct an object from a parsed response.
# 
#         :param dict attributes: object attributes from parsed response
#         """
#         return cls(**{to_snake_case(k): v for k, v in attributes.items()})
# 
#     def to_json(self, minimal=True):
#         """Encode an object as a JSON string.
# 
#         :param bool minimal: Construct a minimal representation of the object (ignore nulls and empty collections)
# 
#         :rtype: str
#         """
#         if minimal:
#             return json.dumps(self.json_repr(minimal=True), cls=MarathonMinimalJsonEncoder, sort_keys=True)
#         else:
#             return json.dumps(self.json_repr(), cls=MarathonJsonEncoder, sort_keys=True)


# Path: marathon/models/container.py
from ..exceptions import InvalidChoiceError
from .base import MarathonObject

    """

    TYPES = ['DOCKER', 'MESOS']
    """Valid container types"""

    def __init__(self, docker=None, type='DOCKER', port_mappings=None, volumes=None):
        if type not in self.TYPES:
            raise InvalidChoiceError('type', type, self.TYPES)
        self.type = type

        # Marathon v1.5 moved portMappings from within container.docker object directly
        # under the container object
        if port_mappings:
            self.port_mappings = [
                pm if isinstance(
                    pm, MarathonContainerPortMapping) else MarathonContainerPortMapping().from_json(pm)
                for pm in (port_mappings or [])
            ]

        if docker:
            self.docker = docker if isinstance(docker, MarathonDockerContainer) \
                else MarathonDockerContainer().from_json(docker)

        self.volumes = [
            v if isinstance(
                v, MarathonContainerVolume) else MarathonContainerVolume().from_json(v)
            for v in (volumes or [])
        ]



class MarathonDockerContainer(MarathonObject):