# coding: utf-8

"""
    Karbon Platform Services API reference.

    OpenAPI documentation for public facing Karbon Platform Services API  This API documentation is generated from source code using go-swagger. Do not edit the generated kps_api.json directly!  # noqa: E501

    OpenAPI spec version: 1.0
    Contact: karbon-platform-services-api@nutanix.com
    Generated by: https://github.com/swagger-api/swagger-codegen.git
"""

import pprint
import re  # noqa: F401

import six
from kps_api.models.script_param import ScriptParam  # noqa: F401,E501


class Function(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 = {
        'code': 'str',
        'description': 'str',
        'environment': 'str',
        'id': 'str',
        'language': 'str',
        'name': 'str',
        'params': 'list[ScriptParam]',
        'project_id': 'str',
        'runtime_id': 'str',
        'runtime_tag': 'str',
        'type': 'str'
    }

    attribute_map = {
        'code': 'code',
        'description': 'description',
        'environment': 'environment',
        'id': 'id',
        'language': 'language',
        'name': 'name',
        'params': 'params',
        'project_id': 'projectId',
        'runtime_id': 'runtimeId',
        'runtime_tag': 'runtimeTag',
        'type': 'type'
    }

    def __init__(self, code=None, description=None, environment=None, id=None, language=None, name=None, params=None, project_id=None, runtime_id=None, runtime_tag=None, type=None):  # noqa: E501
        """Function - a model defined in Swagger"""  # noqa: E501
        self._code = None
        self._description = None
        self._environment = None
        self._id = None
        self._language = None
        self._name = None
        self._params = None
        self._project_id = None
        self._runtime_id = None
        self._runtime_tag = None
        self._type = None
        self.discriminator = None
        self.code = code
        if description is not None:
            self.description = description
        self.environment = environment
        if id is not None:
            self.id = id
        self.language = language
        self.name = name
        self.params = params
        if project_id is not None:
            self.project_id = project_id
        if runtime_id is not None:
            self.runtime_id = runtime_id
        if runtime_tag is not None:
            self.runtime_tag = runtime_tag
        self.type = type

    @property
    def code(self):
        """Gets the code of this Function.  # noqa: E501

        The source code for the function script.  # noqa: E501

        :return: The code of this Function.  # noqa: E501
        :rtype: str
        """
        return self._code

    @code.setter
    def code(self, code):
        """Sets the code of this Function.

        The source code for the function script.  # noqa: E501

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

        self._code = code

    @property
    def description(self):
        """Gets the description of this Function.  # noqa: E501

        Provide a description for your function code/script.  # noqa: E501

        :return: The description of this Function.  # noqa: E501
        :rtype: str
        """
        return self._description

    @description.setter
    def description(self, description):
        """Sets the description of this Function.

        Provide a description for your function code/script.  # noqa: E501

        :param description: The description of this Function.  # noqa: E501
        :type: str
        """

        self._description = description

    @property
    def environment(self):
        """Gets the environment of this Function.  # noqa: E501

        Runtime environment for the function code/script.  # noqa: E501

        :return: The environment of this Function.  # noqa: E501
        :rtype: str
        """
        return self._environment

    @environment.setter
    def environment(self, environment):
        """Sets the environment of this Function.

        Runtime environment for the function code/script.  # noqa: E501

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

        self._environment = environment

    @property
    def id(self):
        """Gets the id of this Function.  # noqa: E501

        ID of the entity Maximum character length is 64 for project, category, and runtime environment, 36 for other entity types.  # noqa: E501

        :return: The id of this Function.  # noqa: E501
        :rtype: str
        """
        return self._id

    @id.setter
    def id(self, id):
        """Sets the id of this Function.

        ID of the entity Maximum character length is 64 for project, category, and runtime environment, 36 for other entity types.  # noqa: E501

        :param id: The id of this Function.  # noqa: E501
        :type: str
        """

        self._id = id

    @property
    def language(self):
        """Gets the language of this Function.  # noqa: E501

        Programming language for the function code/script. Supported languages are python and javascript  # noqa: E501

        :return: The language of this Function.  # noqa: E501
        :rtype: str
        """
        return self._language

    @language.setter
    def language(self, language):
        """Sets the language of this Function.

        Programming language for the function code/script. Supported languages are python and javascript  # noqa: E501

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

        self._language = language

    @property
    def name(self):
        """Gets the name of this Function.  # noqa: E501

        Function name.  # noqa: E501

        :return: The name of this Function.  # noqa: E501
        :rtype: str
        """
        return self._name

    @name.setter
    def name(self, name):
        """Sets the name of this Function.

        Function name.  # noqa: E501

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

        self._name = name

    @property
    def params(self):
        """Gets the params of this Function.  # noqa: E501

        Array of script parameters.  # noqa: E501

        :return: The params of this Function.  # noqa: E501
        :rtype: list[ScriptParam]
        """
        return self._params

    @params.setter
    def params(self, params):
        """Sets the params of this Function.

        Array of script parameters.  # noqa: E501

        :param params: The params of this Function.  # noqa: E501
        :type: list[ScriptParam]
        """
        if params is None:
            raise ValueError("Invalid value for `params`, must not be `None`")  # noqa: E501

        self._params = params

    @property
    def project_id(self):
        """Gets the project_id of this Function.  # noqa: E501

        ID of parent project, required for custom (non-builtin) scripts.  # noqa: E501

        :return: The project_id of this Function.  # noqa: E501
        :rtype: str
        """
        return self._project_id

    @project_id.setter
    def project_id(self, project_id):
        """Sets the project_id of this Function.

        ID of parent project, required for custom (non-builtin) scripts.  # noqa: E501

        :param project_id: The project_id of this Function.  # noqa: E501
        :type: str
        """

        self._project_id = project_id

    @property
    def runtime_id(self):
        """Gets the runtime_id of this Function.  # noqa: E501

        ID of the ScriptRuntime to use to run this script  # noqa: E501

        :return: The runtime_id of this Function.  # noqa: E501
        :rtype: str
        """
        return self._runtime_id

    @runtime_id.setter
    def runtime_id(self, runtime_id):
        """Sets the runtime_id of this Function.

        ID of the ScriptRuntime to use to run this script  # noqa: E501

        :param runtime_id: The runtime_id of this Function.  # noqa: E501
        :type: str
        """

        self._runtime_id = runtime_id

    @property
    def runtime_tag(self):
        """Gets the runtime_tag of this Function.  # noqa: E501

        Docker image tag of the ScriptRuntime to use to run this script. If missing or empty, then backend should treat it as \"latest\"  # noqa: E501

        :return: The runtime_tag of this Function.  # noqa: E501
        :rtype: str
        """
        return self._runtime_tag

    @runtime_tag.setter
    def runtime_tag(self, runtime_tag):
        """Sets the runtime_tag of this Function.

        Docker image tag of the ScriptRuntime to use to run this script. If missing or empty, then backend should treat it as \"latest\"  # noqa: E501

        :param runtime_tag: The runtime_tag of this Function.  # noqa: E501
        :type: str
        """

        self._runtime_tag = runtime_tag

    @property
    def type(self):
        """Gets the type of this Function.  # noqa: E501

        Type of function code/script: Transformation or Function. Transformation takes a data stream as input and produces a different data stream as output. Function takes a data stream as input but has no constraint on output.  # noqa: E501

        :return: The type of this Function.  # noqa: E501
        :rtype: str
        """
        return self._type

    @type.setter
    def type(self, type):
        """Sets the type of this Function.

        Type of function code/script: Transformation or Function. Transformation takes a data stream as input and produces a different data stream as output. Function takes a data stream as input but has no constraint on output.  # noqa: E501

        :param type: The type of this Function.  # noqa: E501
        :type: str
        """
        if type is None:
            raise ValueError("Invalid value for `type`, must not be `None`")  # noqa: E501
        allowed_values = ["Transformation", "Function"]  # noqa: E501
        if type not in allowed_values:
            raise ValueError(
                "Invalid value for `type` ({0}), must be one of {1}"  # noqa: E501
                .format(type, allowed_values)
            )

        self._type = type

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

        for attr, _ in six.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
        if issubclass(Function, dict):
            for key, value in self.items():
                result[key] = value

        return result

    def to_str(self):
        """Returns the string representation of the model"""
        return pprint.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, Function):
            return False

        return self.__dict__ == other.__dict__

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