# coding: utf-8

"""
    Knetik Platform API Documentation latest 

    This is the spec for the Knetik API.  Use this in conjunction with the documentation found at https://knetikcloud.com.

    OpenAPI spec version: latest 
    Contact: support@knetik.com
    Generated by: https://github.com/swagger-api/swagger-codegen.git
"""


from pprint import pformat
from six import iteritems
import re


class ModelProperty(object):
    """
    NOTE: This class is auto generated by the swagger code generator program.
    Do not edit the class manually.
    """


    """
    Attributes:
      swagger_types (dict): The key is attribute name
                            and the value is attribute type.
      attribute_map (dict): The key is attribute name
                            and the value is json key in definition.
    """
    swagger_types = {
        'type': 'str'
    }

    attribute_map = {
        'type': 'type'
    }

    discriminator_value_class_map = {
        'map': 'MapProperty',
        'integer': 'IntegerProperty',
        'file': 'FileProperty',
        'text': 'TextProperty',
        'double': 'DoubleProperty',
        'date': 'DateProperty',
        'audio_group': 'AudioGroupProperty',
        'image': 'ImageProperty',
        'video_group': 'VideoGroupProperty',
        'formatted_text': 'FormattedTextProperty',
        'file_group': 'FileGroupProperty',
        'boolean': 'BooleanProperty',
        'audio': 'AudioProperty',
        'long': 'LongProperty',
        'image_group': 'ImageGroupProperty',
        'list': 'ListProperty',
        'video': 'VideoProperty'
    }

    def __init__(self, type=None):
        """
        ModelProperty - a model defined in Swagger
        """

        self._type = None
        self.discriminator = 'type'

        self.type = type

    @property
    def type(self):
        """
        Gets the type of this ModelProperty.
        The type of the property. Used for polymorphic type recognition and thus must match an expected type with additional properties.

        :return: The type of this ModelProperty.
        :rtype: str
        """
        return self._type

    @type.setter
    def type(self, type):
        """
        Sets the type of this ModelProperty.
        The type of the property. Used for polymorphic type recognition and thus must match an expected type with additional properties.

        :param type: The type of this ModelProperty.
        :type: str
        """
        if type is None:
            raise ValueError("Invalid value for `type`, must not be `None`")

        self._type = type

    def get_real_child_model(self, data):
        """
        Returns the real base class specified by the discriminator
        """
        discriminator_value = data[self.discriminator].lower()
        if self.discriminator_value_class_map.has_key(discriminator_value):
            return self.discriminator_value_class_map[discriminator_value]
        else:
            return None

    def to_dict(self):
        """
        Returns the model properties as a dict
        """
        result = {}

        for attr, _ in iteritems(self.swagger_types):
            value = getattr(self, attr)
            if isinstance(value, list):
                result[attr] = list(map(
                    lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
                    value
                ))
            elif hasattr(value, "to_dict"):
                result[attr] = value.to_dict()
            elif isinstance(value, dict):
                result[attr] = dict(map(
                    lambda item: (item[0], item[1].to_dict())
                    if hasattr(item[1], "to_dict") else item,
                    value.items()
                ))
            else:
                result[attr] = value

        return result

    def to_str(self):
        """
        Returns the string representation of the model
        """
        return pformat(self.to_dict())

    def __repr__(self):
        """
        For `print` and `pprint`
        """
        return self.to_str()

    def __eq__(self, other):
        """
        Returns true if both objects are equal
        """
        if not isinstance(other, ModelProperty):
            return False

        return self.__dict__ == other.__dict__

    def __ne__(self, other):
        """
        Returns true if both objects are not equal
        """
        return not self == other
