# Copyright 2020 The Tekton Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# coding: utf-8

"""
    Tekton

    Tekton Pipeline  # noqa: E501

    The version of the OpenAPI document: v0.17.2
    Generated by: https://openapi-generator.tech
"""


import pprint
import re  # noqa: F401

import six

from tekton_pipeline.configuration import Configuration


class V1beta1TaskRunStatusFields(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 = {
        'cloud_events': 'list[V1beta1CloudEventDelivery]',
        'completion_time': 'V1Time',
        'pod_name': 'str',
        'resources_result': 'list[V1beta1PipelineResourceResult]',
        'retries_status': 'list[V1beta1TaskRunStatus]',
        'sidecars': 'list[V1beta1SidecarState]',
        'start_time': 'V1Time',
        'steps': 'list[V1beta1StepState]',
        'task_results': 'list[V1beta1TaskRunResult]',
        'task_spec': 'V1beta1TaskSpec'
    }

    attribute_map = {
        'cloud_events': 'cloudEvents',
        'completion_time': 'completionTime',
        'pod_name': 'podName',
        'resources_result': 'resourcesResult',
        'retries_status': 'retriesStatus',
        'sidecars': 'sidecars',
        'start_time': 'startTime',
        'steps': 'steps',
        'task_results': 'taskResults',
        'task_spec': 'taskSpec'
    }

    def __init__(self, cloud_events=None, completion_time=None, pod_name=None, resources_result=None, retries_status=None, sidecars=None, start_time=None, steps=None, task_results=None, task_spec=None, local_vars_configuration=None):  # noqa: E501
        """V1beta1TaskRunStatusFields - 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._cloud_events = None
        self._completion_time = None
        self._pod_name = None
        self._resources_result = None
        self._retries_status = None
        self._sidecars = None
        self._start_time = None
        self._steps = None
        self._task_results = None
        self._task_spec = None
        self.discriminator = None

        if cloud_events is not None:
            self.cloud_events = cloud_events
        if completion_time is not None:
            self.completion_time = completion_time
        self.pod_name = pod_name
        if resources_result is not None:
            self.resources_result = resources_result
        if retries_status is not None:
            self.retries_status = retries_status
        if sidecars is not None:
            self.sidecars = sidecars
        if start_time is not None:
            self.start_time = start_time
        if steps is not None:
            self.steps = steps
        if task_results is not None:
            self.task_results = task_results
        if task_spec is not None:
            self.task_spec = task_spec

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

        CloudEvents describe the state of each cloud event requested via a CloudEventResource.  # noqa: E501

        :return: The cloud_events of this V1beta1TaskRunStatusFields.  # noqa: E501
        :rtype: list[V1beta1CloudEventDelivery]
        """
        return self._cloud_events

    @cloud_events.setter
    def cloud_events(self, cloud_events):
        """Sets the cloud_events of this V1beta1TaskRunStatusFields.

        CloudEvents describe the state of each cloud event requested via a CloudEventResource.  # noqa: E501

        :param cloud_events: The cloud_events of this V1beta1TaskRunStatusFields.  # noqa: E501
        :type: list[V1beta1CloudEventDelivery]
        """

        self._cloud_events = cloud_events

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


        :return: The completion_time of this V1beta1TaskRunStatusFields.  # noqa: E501
        :rtype: V1Time
        """
        return self._completion_time

    @completion_time.setter
    def completion_time(self, completion_time):
        """Sets the completion_time of this V1beta1TaskRunStatusFields.


        :param completion_time: The completion_time of this V1beta1TaskRunStatusFields.  # noqa: E501
        :type: V1Time
        """

        self._completion_time = completion_time

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

        PodName is the name of the pod responsible for executing this task's steps.  # noqa: E501

        :return: The pod_name of this V1beta1TaskRunStatusFields.  # noqa: E501
        :rtype: str
        """
        return self._pod_name

    @pod_name.setter
    def pod_name(self, pod_name):
        """Sets the pod_name of this V1beta1TaskRunStatusFields.

        PodName is the name of the pod responsible for executing this task's steps.  # noqa: E501

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

        self._pod_name = pod_name

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

        Results from Resources built during the taskRun. currently includes the digest of build container images  # noqa: E501

        :return: The resources_result of this V1beta1TaskRunStatusFields.  # noqa: E501
        :rtype: list[V1beta1PipelineResourceResult]
        """
        return self._resources_result

    @resources_result.setter
    def resources_result(self, resources_result):
        """Sets the resources_result of this V1beta1TaskRunStatusFields.

        Results from Resources built during the taskRun. currently includes the digest of build container images  # noqa: E501

        :param resources_result: The resources_result of this V1beta1TaskRunStatusFields.  # noqa: E501
        :type: list[V1beta1PipelineResourceResult]
        """

        self._resources_result = resources_result

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

        RetriesStatus contains the history of TaskRunStatus in case of a retry in order to keep record of failures. All TaskRunStatus stored in RetriesStatus will have no date within the RetriesStatus as is redundant.  # noqa: E501

        :return: The retries_status of this V1beta1TaskRunStatusFields.  # noqa: E501
        :rtype: list[V1beta1TaskRunStatus]
        """
        return self._retries_status

    @retries_status.setter
    def retries_status(self, retries_status):
        """Sets the retries_status of this V1beta1TaskRunStatusFields.

        RetriesStatus contains the history of TaskRunStatus in case of a retry in order to keep record of failures. All TaskRunStatus stored in RetriesStatus will have no date within the RetriesStatus as is redundant.  # noqa: E501

        :param retries_status: The retries_status of this V1beta1TaskRunStatusFields.  # noqa: E501
        :type: list[V1beta1TaskRunStatus]
        """

        self._retries_status = retries_status

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

        The list has one entry per sidecar in the manifest. Each entry is represents the imageid of the corresponding sidecar.  # noqa: E501

        :return: The sidecars of this V1beta1TaskRunStatusFields.  # noqa: E501
        :rtype: list[V1beta1SidecarState]
        """
        return self._sidecars

    @sidecars.setter
    def sidecars(self, sidecars):
        """Sets the sidecars of this V1beta1TaskRunStatusFields.

        The list has one entry per sidecar in the manifest. Each entry is represents the imageid of the corresponding sidecar.  # noqa: E501

        :param sidecars: The sidecars of this V1beta1TaskRunStatusFields.  # noqa: E501
        :type: list[V1beta1SidecarState]
        """

        self._sidecars = sidecars

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


        :return: The start_time of this V1beta1TaskRunStatusFields.  # noqa: E501
        :rtype: V1Time
        """
        return self._start_time

    @start_time.setter
    def start_time(self, start_time):
        """Sets the start_time of this V1beta1TaskRunStatusFields.


        :param start_time: The start_time of this V1beta1TaskRunStatusFields.  # noqa: E501
        :type: V1Time
        """

        self._start_time = start_time

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

        Steps describes the state of each build step container.  # noqa: E501

        :return: The steps of this V1beta1TaskRunStatusFields.  # noqa: E501
        :rtype: list[V1beta1StepState]
        """
        return self._steps

    @steps.setter
    def steps(self, steps):
        """Sets the steps of this V1beta1TaskRunStatusFields.

        Steps describes the state of each build step container.  # noqa: E501

        :param steps: The steps of this V1beta1TaskRunStatusFields.  # noqa: E501
        :type: list[V1beta1StepState]
        """

        self._steps = steps

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

        TaskRunResults are the list of results written out by the task's containers  # noqa: E501

        :return: The task_results of this V1beta1TaskRunStatusFields.  # noqa: E501
        :rtype: list[V1beta1TaskRunResult]
        """
        return self._task_results

    @task_results.setter
    def task_results(self, task_results):
        """Sets the task_results of this V1beta1TaskRunStatusFields.

        TaskRunResults are the list of results written out by the task's containers  # noqa: E501

        :param task_results: The task_results of this V1beta1TaskRunStatusFields.  # noqa: E501
        :type: list[V1beta1TaskRunResult]
        """

        self._task_results = task_results

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


        :return: The task_spec of this V1beta1TaskRunStatusFields.  # noqa: E501
        :rtype: V1beta1TaskSpec
        """
        return self._task_spec

    @task_spec.setter
    def task_spec(self, task_spec):
        """Sets the task_spec of this V1beta1TaskRunStatusFields.


        :param task_spec: The task_spec of this V1beta1TaskRunStatusFields.  # noqa: E501
        :type: V1beta1TaskSpec
        """

        self._task_spec = task_spec

    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, V1beta1TaskRunStatusFields):
            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, V1beta1TaskRunStatusFields):
            return True

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