# coding: utf-8

"""
    3blades API

    No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)

    OpenAPI spec version: 1.0
    
    Generated by: https://github.com/swagger-api/swagger-codegen.git
"""


from pprint import pformat
from six import iteritems
import re


class ServerAction(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 = {
        'id': 'str',
        'name': 'str',
        'operation': 'str',
        'webhook': 'Webhook'
    }

    attribute_map = {
        'id': 'id',
        'name': 'name',
        'operation': 'operation',
        'webhook': 'webhook'
    }

    def __init__(self, id=None, name=None, operation=None, webhook=None):
        """
        ServerAction - a model defined in Swagger
        """

        self._id = None
        self._name = None
        self._operation = None
        self._webhook = None

        if id is not None:
          self.id = id
        if name is not None:
          self.name = name
        if operation is not None:
          self.operation = operation
        if webhook is not None:
          self.webhook = webhook

    @property
    def id(self):
        """
        Gets the id of this ServerAction.
        Server trigger unique identifier.

        :return: The id of this ServerAction.
        :rtype: str
        """
        return self._id

    @id.setter
    def id(self, id):
        """
        Sets the id of this ServerAction.
        Server trigger unique identifier.

        :param id: The id of this ServerAction.
        :type: str
        """

        self._id = id

    @property
    def name(self):
        """
        Gets the name of this ServerAction.
        Name for server action.

        :return: The name of this ServerAction.
        :rtype: str
        """
        return self._name

    @name.setter
    def name(self, name):
        """
        Sets the name of this ServerAction.
        Name for server action.

        :param name: The name of this ServerAction.
        :type: str
        """

        self._name = name

    @property
    def operation(self):
        """
        Gets the operation of this ServerAction.
        Manage server state. Starting a server changes state from Pending to Running. Terminating a server changes state from Running to Terminated. If the action results in Error, status will change to Error. 

        :return: The operation of this ServerAction.
        :rtype: str
        """
        return self._operation

    @operation.setter
    def operation(self, operation):
        """
        Sets the operation of this ServerAction.
        Manage server state. Starting a server changes state from Pending to Running. Terminating a server changes state from Running to Terminated. If the action results in Error, status will change to Error. 

        :param operation: The operation of this ServerAction.
        :type: str
        """
        allowed_values = ["start", "stop", "terminate"]
        if operation not in allowed_values:
            raise ValueError(
                "Invalid value for `operation` ({0}), must be one of {1}"
                .format(operation, allowed_values)
            )

        self._operation = operation

    @property
    def webhook(self):
        """
        Gets the webhook of this ServerAction.

        :return: The webhook of this ServerAction.
        :rtype: Webhook
        """
        return self._webhook

    @webhook.setter
    def webhook(self, webhook):
        """
        Sets the webhook of this ServerAction.

        :param webhook: The webhook of this ServerAction.
        :type: Webhook
        """

        self._webhook = webhook

    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, ServerAction):
            return False

        return self.__dict__ == other.__dict__

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