# coding: utf-8

{{>partial_header}}

{{#models}}
{{#model}}
from pprint import pformat
from six import iteritems
import re


class {{classname}}(object):
    """
    NOTE: This class is auto generated by the swagger code generator program.
    Do not edit the class manually.
    """
    def __init__(self{{#readWriteVars}}, {{name}}={{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}None{{/defaultValue}}{{/readWriteVars}}):
        """
        {{classname}} - a model defined in Swagger

        :param dict swaggerTypes: The key is attribute name
                                  and the value is attribute type.
        :param dict attributeMap: The key is attribute name
                                  and the value is json key in definition.
        """
        self.swagger_types = {
            {{#vars}}'{{name}}': '{{{datatype}}}'{{#hasMore}},
            {{/hasMore}}{{/vars}}
        }

        self.attribute_map = {
            {{#vars}}'{{name}}': '{{baseName}}'{{#hasMore}},
            {{/hasMore}}{{/vars}}
        }

{{#readOnlyVars}}
        self._{{name}} = {{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}None{{/defaultValue}}
{{/readOnlyVars}}
{{#readWriteVars}}
        self._{{name}} = {{name}}
{{/readWriteVars}}
{{#vars}}{{#-first}}
{{/-first}}
    @property
    def {{name}}(self):
        """
        Gets the {{name}} of this {{classname}}.
{{#description}}        {{{description}}}{{/description}}

        :return: The {{name}} of this {{classname}}.
        :rtype: {{datatype}}
        """
        return self._{{name}}

{{^isReadOnly}}
    @{{name}}.setter
    def {{name}}(self, {{name}}):
        """
        Sets the {{name}} of this {{classname}}.
{{#description}}        {{{description}}}{{/description}}

        :param {{name}}: The {{name}} of this {{classname}}.
        :type: {{datatype}}
        """
{{#isEnum}}
        allowed_values = [{{#allowableValues}}{{#values}}"{{{this}}}"{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}]
        if {{{name}}} not in allowed_values:
            raise ValueError(
                "Invalid value for `{{{name}}}` ({0}), must be one of {1}"
                .format({{{name}}}, allowed_values)
            )
{{/isEnum}}
{{^isEnum}}
{{#hasValidation}}

        if not {{name}}:
            raise ValueError("Invalid value for `{{name}}`, must not be `None`")
{{#maxLength}}
        if len({{name}}) > {{maxLength}}:
            raise ValueError("Invalid value for `{{name}}`, length must be less than `{{maxLength}}`")
{{/maxLength}}
{{#minLength}}
        if len({{name}}) < {{minLength}}:
            raise ValueError("Invalid value for `{{name}}`, length must be greater than or equal to `{{minLength}}`")
{{/minLength}}
{{#maximum}}
        if {{name}} > {{maximum}}:
            raise ValueError("Invalid value for `{{name}}`, must be a value less than or equal to `{{maximum}}`")
{{/maximum}}
{{#minimum}}
        if {{name}} < {{minimum}}:
            raise ValueError("Invalid value for `{{name}}`, must be a value greater than or equal to `{{minimum}}`")
{{/minimum}}
{{#pattern}}
        if not re.search('{{vendorExtensions.x-regex}}', {{name}}{{#vendorExtensions.x-modifiers}}{{#-first}}, flags={{/-first}}re.{{.}}{{^-last}} | {{/-last}}{{/vendorExtensions.x-modifiers}}):
            raise ValueError("Invalid value for `{{name}}`, must be a follow pattern or equal to `{{pattern}}`")
{{/pattern}}
{{/hasValidation}}
{{/isEnum}}

        self._{{name}} = {{name}}

{{/isReadOnly}}
{{/vars}}
    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
        """
        return self.__dict__ == other.__dict__

    def __ne__(self, other):
        """
        Returns true if both objects are not equal
        """
        return not self == other
{{/model}}
{{/models}}
