# coding=utf-8
r"""
This code was generated by
\ / _    _  _|   _  _
 | (_)\/(_)(_|\/| |(/_  v1.0.0
      /       /
"""

from twilio.base import deserialize
from twilio.base import values
from twilio.base.instance_resource import InstanceResource
from twilio.base.list_resource import ListResource
from twilio.base.page import Page


class TaskQueueBulkRealTimeStatisticsList(ListResource):

    def __init__(self, version, workspace_sid):
        """
        Initialize the TaskQueueBulkRealTimeStatisticsList

        :param Version version: Version that contains the resource
        :param workspace_sid: The SID of the Workspace that contains the TaskQueue

        :returns: twilio.rest.taskrouter.v1.workspace.task_queue_bulk_real_time_statistics.TaskQueueBulkRealTimeStatisticsList
        :rtype: twilio.rest.taskrouter.v1.workspace.task_queue_bulk_real_time_statistics.TaskQueueBulkRealTimeStatisticsList
        """
        super(TaskQueueBulkRealTimeStatisticsList, self).__init__(version)

        # Path Solution
        self._solution = {'workspace_sid': workspace_sid, }
        self._uri = '/Workspaces/{workspace_sid}/TaskQueues/RealTimeStatistics'.format(**self._solution)

    def create(self):
        """
        Create the TaskQueueBulkRealTimeStatisticsInstance

        :returns: The created TaskQueueBulkRealTimeStatisticsInstance
        :rtype: twilio.rest.taskrouter.v1.workspace.task_queue_bulk_real_time_statistics.TaskQueueBulkRealTimeStatisticsInstance
        """
        payload = self._version.create(method='POST', uri=self._uri, )

        return TaskQueueBulkRealTimeStatisticsInstance(
            self._version,
            payload,
            workspace_sid=self._solution['workspace_sid'],
        )

    def __repr__(self):
        """
        Provide a friendly representation

        :returns: Machine friendly representation
        :rtype: str
        """
        return '<Twilio.Taskrouter.V1.TaskQueueBulkRealTimeStatisticsList>'


class TaskQueueBulkRealTimeStatisticsPage(Page):

    def __init__(self, version, response, solution):
        """
        Initialize the TaskQueueBulkRealTimeStatisticsPage

        :param Version version: Version that contains the resource
        :param Response response: Response from the API
        :param workspace_sid: The SID of the Workspace that contains the TaskQueue

        :returns: twilio.rest.taskrouter.v1.workspace.task_queue_bulk_real_time_statistics.TaskQueueBulkRealTimeStatisticsPage
        :rtype: twilio.rest.taskrouter.v1.workspace.task_queue_bulk_real_time_statistics.TaskQueueBulkRealTimeStatisticsPage
        """
        super(TaskQueueBulkRealTimeStatisticsPage, self).__init__(version, response)

        # Path Solution
        self._solution = solution

    def get_instance(self, payload):
        """
        Build an instance of TaskQueueBulkRealTimeStatisticsInstance

        :param dict payload: Payload response from the API

        :returns: twilio.rest.taskrouter.v1.workspace.task_queue_bulk_real_time_statistics.TaskQueueBulkRealTimeStatisticsInstance
        :rtype: twilio.rest.taskrouter.v1.workspace.task_queue_bulk_real_time_statistics.TaskQueueBulkRealTimeStatisticsInstance
        """
        return TaskQueueBulkRealTimeStatisticsInstance(
            self._version,
            payload,
            workspace_sid=self._solution['workspace_sid'],
        )

    def __repr__(self):
        """
        Provide a friendly representation

        :returns: Machine friendly representation
        :rtype: str
        """
        return '<Twilio.Taskrouter.V1.TaskQueueBulkRealTimeStatisticsPage>'


class TaskQueueBulkRealTimeStatisticsInstance(InstanceResource):

    def __init__(self, version, payload, workspace_sid):
        """
        Initialize the TaskQueueBulkRealTimeStatisticsInstance

        :returns: twilio.rest.taskrouter.v1.workspace.task_queue_bulk_real_time_statistics.TaskQueueBulkRealTimeStatisticsInstance
        :rtype: twilio.rest.taskrouter.v1.workspace.task_queue_bulk_real_time_statistics.TaskQueueBulkRealTimeStatisticsInstance
        """
        super(TaskQueueBulkRealTimeStatisticsInstance, self).__init__(version)

        # Marshaled Properties
        self._properties = {
            'account_sid': payload.get('account_sid'),
            'workspace_sid': payload.get('workspace_sid'),
            'task_queue_data': payload.get('task_queue_data'),
            'task_queue_response_count': deserialize.integer(payload.get('task_queue_response_count')),
            'url': payload.get('url'),
        }

        # Context
        self._context = None
        self._solution = {'workspace_sid': workspace_sid, }

    @property
    def account_sid(self):
        """
        :returns: The SID of the Account that created the resource
        :rtype: unicode
        """
        return self._properties['account_sid']

    @property
    def workspace_sid(self):
        """
        :returns: The SID of the Workspace that contains the TaskQueue
        :rtype: unicode
        """
        return self._properties['workspace_sid']

    @property
    def task_queue_data(self):
        """
        :returns: Task Queue data grouped by task_queue_sid
        :rtype: dict
        """
        return self._properties['task_queue_data']

    @property
    def task_queue_response_count(self):
        """
        :returns: The number of TaskQueue statistics received
        :rtype: unicode
        """
        return self._properties['task_queue_response_count']

    @property
    def url(self):
        """
        :returns: The absolute URL of the TaskQueue statistics resource
        :rtype: unicode
        """
        return self._properties['url']

    def __repr__(self):
        """
        Provide a friendly representation

        :returns: Machine friendly representation
        :rtype: str
        """
        return '<Twilio.Taskrouter.V1.TaskQueueBulkRealTimeStatisticsInstance>'
