# coding: utf-8

"""
    Cloud Manager API

    This API allows access to Cloud Manager programs, pipelines, and environments by an authorized technical account created through the Adobe I/O Console. The base url for this API is https://cloudmanager.adobe.io, e.g. to get the list of programs for an organization, you would make a GET request to https://cloudmanager.adobe.io/api/programs (with the correct set of headers as described below). This swagger file can be downloaded from https://raw.githubusercontent.com/AdobeDocs/cloudmanager-api-docs/master/swagger-specs/api.yaml.  # noqa: E501

    The version of the OpenAPI document: 1.0.0
    Contact: <EMAIL>
    Generated by: https://openapi-generator.tech
"""


import pprint
import re  # noqa: F401

import six

from pyaemcloudmanagerapi.configuration import Configuration


class Pipeline(object):
    """NOTE: This class is auto generated by OpenAPI Generator.
    Ref: https://openapi-generator.tech

    Do not edit the class manually.
    """

    """
    Attributes:
      openapi_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.
    """
    openapi_types = {
        'id': 'str',
        'program_id': 'str',
        'name': 'str',
        'trigger': 'str',
        'status': 'str',
        'created_at': 'datetime',
        'updated_at': 'datetime',
        'last_started_at': 'datetime',
        'last_finished_at': 'datetime',
        'phases': 'list[PipelinePhase]',
        'links': 'PipelineLinks'
    }

    attribute_map = {
        'id': 'id',
        'program_id': 'programId',
        'name': 'name',
        'trigger': 'trigger',
        'status': 'status',
        'created_at': 'createdAt',
        'updated_at': 'updatedAt',
        'last_started_at': 'lastStartedAt',
        'last_finished_at': 'lastFinishedAt',
        'phases': 'phases',
        'links': '_links'
    }

    def __init__(self, id=None, program_id=None, name=None, trigger=None, status=None, created_at=None, updated_at=None, last_started_at=None, last_finished_at=None, phases=None, links=None, local_vars_configuration=None):  # noqa: E501
        """Pipeline - a model defined in OpenAPI"""  # noqa: E501
        if local_vars_configuration is None:
            local_vars_configuration = Configuration()
        self.local_vars_configuration = local_vars_configuration

        self._id = None
        self._program_id = None
        self._name = None
        self._trigger = None
        self._status = None
        self._created_at = None
        self._updated_at = None
        self._last_started_at = None
        self._last_finished_at = None
        self._phases = None
        self._links = None
        self.discriminator = None

        if id is not None:
            self.id = id
        if program_id is not None:
            self.program_id = program_id
        self.name = name
        if trigger is not None:
            self.trigger = trigger
        if status is not None:
            self.status = status
        if created_at is not None:
            self.created_at = created_at
        if updated_at is not None:
            self.updated_at = updated_at
        if last_started_at is not None:
            self.last_started_at = last_started_at
        if last_finished_at is not None:
            self.last_finished_at = last_finished_at
        self.phases = phases
        if links is not None:
            self.links = links

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

        Identifier of the pipeline. Unique within the program.  # noqa: E501

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

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

        Identifier of the pipeline. Unique within the program.  # noqa: E501

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

        self._id = id

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

        Identifier of the program. Unique within the space.  # noqa: E501

        :return: The program_id of this Pipeline.  # noqa: E501
        :rtype: str
        """
        return self._program_id

    @program_id.setter
    def program_id(self, program_id):
        """Sets the program_id of this Pipeline.

        Identifier of the program. Unique within the space.  # noqa: E501

        :param program_id: The program_id of this Pipeline.  # noqa: E501
        :type: str
        """

        self._program_id = program_id

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

        Name of the pipeline  # noqa: E501

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

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

        Name of the pipeline  # noqa: E501

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

        self._name = name

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

        How should the execution be triggered. ON_COMMIT: each time a PR is available and the Pipeline is idle then a execution is triggered. MANUAL: triggerd through UI or API. SCHEDULE: recurring schedule (not yet implemented}  # noqa: E501

        :return: The trigger of this Pipeline.  # noqa: E501
        :rtype: str
        """
        return self._trigger

    @trigger.setter
    def trigger(self, trigger):
        """Sets the trigger of this Pipeline.

        How should the execution be triggered. ON_COMMIT: each time a PR is available and the Pipeline is idle then a execution is triggered. MANUAL: triggerd through UI or API. SCHEDULE: recurring schedule (not yet implemented}  # noqa: E501

        :param trigger: The trigger of this Pipeline.  # noqa: E501
        :type: str
        """
        allowed_values = ["ON_COMMIT", "MANUAL", "SCHEDULE"]  # noqa: E501
        if self.local_vars_configuration.client_side_validation and trigger not in allowed_values:  # noqa: E501
            raise ValueError(
                "Invalid value for `trigger` ({0}), must be one of {1}"  # noqa: E501
                .format(trigger, allowed_values)
            )

        self._trigger = trigger

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

        Pipeline status  # noqa: E501

        :return: The status of this Pipeline.  # noqa: E501
        :rtype: str
        """
        return self._status

    @status.setter
    def status(self, status):
        """Sets the status of this Pipeline.

        Pipeline status  # noqa: E501

        :param status: The status of this Pipeline.  # noqa: E501
        :type: str
        """
        allowed_values = ["IDLE", "BUSY", "WAITING"]  # noqa: E501
        if self.local_vars_configuration.client_side_validation and status not in allowed_values:  # noqa: E501
            raise ValueError(
                "Invalid value for `status` ({0}), must be one of {1}"  # noqa: E501
                .format(status, allowed_values)
            )

        self._status = status

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

        Create date  # noqa: E501

        :return: The created_at of this Pipeline.  # noqa: E501
        :rtype: datetime
        """
        return self._created_at

    @created_at.setter
    def created_at(self, created_at):
        """Sets the created_at of this Pipeline.

        Create date  # noqa: E501

        :param created_at: The created_at of this Pipeline.  # noqa: E501
        :type: datetime
        """

        self._created_at = created_at

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

        Update date  # noqa: E501

        :return: The updated_at of this Pipeline.  # noqa: E501
        :rtype: datetime
        """
        return self._updated_at

    @updated_at.setter
    def updated_at(self, updated_at):
        """Sets the updated_at of this Pipeline.

        Update date  # noqa: E501

        :param updated_at: The updated_at of this Pipeline.  # noqa: E501
        :type: datetime
        """

        self._updated_at = updated_at

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

        Last pipeline execution start  # noqa: E501

        :return: The last_started_at of this Pipeline.  # noqa: E501
        :rtype: datetime
        """
        return self._last_started_at

    @last_started_at.setter
    def last_started_at(self, last_started_at):
        """Sets the last_started_at of this Pipeline.

        Last pipeline execution start  # noqa: E501

        :param last_started_at: The last_started_at of this Pipeline.  # noqa: E501
        :type: datetime
        """

        self._last_started_at = last_started_at

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

        Last pipeline execution end  # noqa: E501

        :return: The last_finished_at of this Pipeline.  # noqa: E501
        :rtype: datetime
        """
        return self._last_finished_at

    @last_finished_at.setter
    def last_finished_at(self, last_finished_at):
        """Sets the last_finished_at of this Pipeline.

        Last pipeline execution end  # noqa: E501

        :param last_finished_at: The last_finished_at of this Pipeline.  # noqa: E501
        :type: datetime
        """

        self._last_finished_at = last_finished_at

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

        Pipeline phases in execution order  # noqa: E501

        :return: The phases of this Pipeline.  # noqa: E501
        :rtype: list[PipelinePhase]
        """
        return self._phases

    @phases.setter
    def phases(self, phases):
        """Sets the phases of this Pipeline.

        Pipeline phases in execution order  # noqa: E501

        :param phases: The phases of this Pipeline.  # noqa: E501
        :type: list[PipelinePhase]
        """
        if self.local_vars_configuration.client_side_validation and phases is None:  # noqa: E501
            raise ValueError("Invalid value for `phases`, must not be `None`")  # noqa: E501

        self._phases = phases

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


        :return: The links of this Pipeline.  # noqa: E501
        :rtype: PipelineLinks
        """
        return self._links

    @links.setter
    def links(self, links):
        """Sets the links of this Pipeline.


        :param links: The links of this Pipeline.  # noqa: E501
        :type: PipelineLinks
        """

        self._links = links

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

        for attr, _ in six.iteritems(self.openapi_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 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, Pipeline):
            return False

        return self.to_dict() == other.to_dict()

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

        return self.to_dict() != other.to_dict()
