##
#    This code was generated by
#    ___ _ _ _ _ _    _ ____    ____ ____ _    ____ ____ _  _ ____ ____ ____ ___ __   __
#     |  | | | | |    | |  | __ |  | |__| | __ | __ |___ |\ | |___ |__/ |__|  | |  | |__/
#     |  |_|_| | |___ | |__|    |__| |  | |    |__] |___ | \| |___ |  \ |  |  | |__| |  \
#
#    Twilio - Taskrouter
#    This is the public Twilio REST API.
#
#    NOTE: This class is auto generated by OpenAPI Generator.
#    https://openapi-generator.tech
#    Do not edit the class manually.
#


module Twilio
    module REST
        class Taskrouter < TaskrouterBase
            class V1 < Version
                class WorkspaceContext < InstanceContext
                class WorkerContext < InstanceContext

                     class ReservationList < ListResource
                
                    ##
                    # Initialize the ReservationList
                    # @param [Version] version Version that contains the resource
                    # @return [ReservationList] ReservationList
                    def initialize(version, workspace_sid: nil, worker_sid: nil)
                        super(version)
                        # Path Solution
                        @solution = { workspace_sid: workspace_sid, worker_sid: worker_sid }
                        @uri = "/Workspaces/#{@solution[:workspace_sid]}/Workers/#{@solution[:worker_sid]}/Reservations"
                        
                    end
                
                    ##
                    # Lists ReservationInstance records from the API as a list.
                    # Unlike stream(), this operation is eager and will load `limit` records into
                    # memory before returning.
                    # @param [Status] reservation_status Returns the list of reservations for a worker with a specified ReservationStatus. Can be: `pending`, `accepted`, `rejected`, `timeout`, `canceled`, or `rescinded`.
                    # @param [Integer] limit Upper limit for the number of records to return. stream()
                    #    guarantees to never return more than limit.  Default is no limit
                    # @param [Integer] page_size Number of records to fetch per request, when
                    #    not set will use the default value of 50 records.  If no page_size is defined
                    #    but a limit is defined, stream() will attempt to read the limit with the most
                    #    efficient page size, i.e. min(limit, 1000)
                    # @return [Array] Array of up to limit results
                    def list(reservation_status: :unset, limit: nil, page_size: nil)
                        self.stream(
                            reservation_status: reservation_status,
                            limit: limit,
                            page_size: page_size
                        ).entries
                    end

                    ##
                    # Streams Instance records from the API as an Enumerable.
                    # This operation lazily loads records as efficiently as possible until the limit
                    # is reached.
                    # @param [Status] reservation_status Returns the list of reservations for a worker with a specified ReservationStatus. Can be: `pending`, `accepted`, `rejected`, `timeout`, `canceled`, or `rescinded`.
                    # @param [Integer] limit Upper limit for the number of records to return. stream()
                    #    guarantees to never return more than limit.  Default is no limit
                    # @param [Integer] page_size Number of records to fetch per request, when
                    #    not set will use the default value of 50 records.  If no page_size is defined
                    #    but a limit is defined, stream() will attempt to read the limit with the most
                    #    efficient page size, i.e. min(limit, 1000)
                    # @return [Enumerable] Enumerable that will yield up to limit results
                    def stream(reservation_status: :unset, limit: nil, page_size: nil)
                        limits = @version.read_limits(limit, page_size)

                        page = self.page(
                            reservation_status: reservation_status,
                            page_size: limits[:page_size], )

                        @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
                    end

                    ##
                    # When passed a block, yields ReservationInstance records from the API.
                    # This operation lazily loads records as efficiently as possible until the limit
                    # is reached.
                    def each
                        limits = @version.read_limits

                        page = self.page(page_size: limits[:page_size], )

                        @version.stream(page,
                            limit: limits[:limit],
                            page_limit: limits[:page_limit]).each {|x| yield x}
                    end

                    ##
                    # Retrieve a single page of ReservationInstance records from the API.
                    # Request is executed immediately.
                    # @param [Status] reservation_status Returns the list of reservations for a worker with a specified ReservationStatus. Can be: `pending`, `accepted`, `rejected`, `timeout`, `canceled`, or `rescinded`.
                    # @param [String] page_token PageToken provided by the API
                    # @param [Integer] page_number Page Number, this value is simply for client state
                    # @param [Integer] page_size Number of records to return, defaults to 50
                    # @return [Page] Page of ReservationInstance
                    def page(reservation_status: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
                        params = Twilio::Values.of({
                            'ReservationStatus' => reservation_status,
                            'PageToken' => page_token,
                            'Page' => page_number,
                            'PageSize' => page_size,
                        })
                        headers = Twilio::Values.of({})
                        
                        

                        response = @version.page('GET', @uri, params: params, headers: headers)

                        ReservationPage.new(@version, response, @solution)
                    end

                    ##
                    # Retrieve a single page of ReservationInstance records from the API.
                    # Request is executed immediately.
                    # @param [String] target_url API-generated URL for the requested results page
                    # @return [Page] Page of ReservationInstance
                    def get_page(target_url)
                        response = @version.domain.request(
                            'GET',
                            target_url
                        )
                    ReservationPage.new(@version, response, @solution)
                    end
                    


                    # Provide a user friendly representation
                    def to_s
                        '#<Twilio.Taskrouter.V1.ReservationList>'
                    end
                end


                class ReservationContext < InstanceContext
                    ##
                    # Initialize the ReservationContext
                    # @param [Version] version Version that contains the resource
                    # @param [String] workspace_sid The SID of the Workspace with the WorkerReservation resources to update.
                    # @param [String] worker_sid The SID of the reserved Worker resource with the WorkerReservation resources to update.
                    # @param [String] sid The SID of the WorkerReservation resource to update.
                    # @return [ReservationContext] ReservationContext
                    def initialize(version, workspace_sid, worker_sid, sid)
                        super(version)

                        # Path Solution
                        @solution = { workspace_sid: workspace_sid, worker_sid: worker_sid, sid: sid,  }
                        @uri = "/Workspaces/#{@solution[:workspace_sid]}/Workers/#{@solution[:worker_sid]}/Reservations/#{@solution[:sid]}"

                        
                    end
                    ##
                    # Fetch the ReservationInstance
                    # @return [ReservationInstance] Fetched ReservationInstance
                    def fetch

                        headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
                        
                        
                        
                        
                        
                        payload = @version.fetch('GET', @uri, headers: headers)
                        ReservationInstance.new(
                            @version,
                            payload,
                            workspace_sid: @solution[:workspace_sid],
                            worker_sid: @solution[:worker_sid],
                            sid: @solution[:sid],
                        )
                    end

                    ##
                    # Update the ReservationInstance
                    # @param [Status] reservation_status 
                    # @param [String] worker_activity_sid The new worker activity SID if rejecting a reservation.
                    # @param [String] instruction The assignment instruction for the reservation.
                    # @param [String] dequeue_post_work_activity_sid The SID of the Activity resource to start after executing a Dequeue instruction.
                    # @param [String] dequeue_from The caller ID of the call to the worker when executing a Dequeue instruction.
                    # @param [String] dequeue_record Whether to record both legs of a call when executing a Dequeue instruction or which leg to record.
                    # @param [String] dequeue_timeout The timeout for call when executing a Dequeue instruction.
                    # @param [String] dequeue_to The contact URI of the worker when executing a Dequeue instruction. Can be the URI of the Twilio Client, the SIP URI for Programmable SIP, or the [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone number, depending on the destination.
                    # @param [String] dequeue_status_callback_url The callback URL for completed call event when executing a Dequeue instruction.
                    # @param [String] call_from The Caller ID of the outbound call when executing a Call instruction.
                    # @param [String] call_record Whether to record both legs of a call when executing a Call instruction.
                    # @param [String] call_timeout The timeout for a call when executing a Call instruction.
                    # @param [String] call_to The contact URI of the worker when executing a Call instruction. Can be the URI of the Twilio Client, the SIP URI for Programmable SIP, or the [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone number, depending on the destination.
                    # @param [String] call_url TwiML URI executed on answering the worker's leg as a result of the Call instruction.
                    # @param [String] call_status_callback_url The URL to call for the completed call event when executing a Call instruction.
                    # @param [Boolean] call_accept Whether to accept a reservation when executing a Call instruction.
                    # @param [String] redirect_call_sid The Call SID of the call parked in the queue when executing a Redirect instruction.
                    # @param [Boolean] redirect_accept Whether the reservation should be accepted when executing a Redirect instruction.
                    # @param [String] redirect_url TwiML URI to redirect the call to when executing the Redirect instruction.
                    # @param [String] to The Contact URI of the worker when executing a Conference instruction. Can be the URI of the Twilio Client, the SIP URI for Programmable SIP, or the [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone number, depending on the destination.
                    # @param [String] from The caller ID of the call to the worker when executing a Conference instruction.
                    # @param [String] status_callback The URL we should call using the `status_callback_method` to send status information to your application.
                    # @param [String] status_callback_method The HTTP method we should use to call `status_callback`. Can be: `POST` or `GET` and the default is `POST`.
                    # @param [Array[CallStatus]] status_callback_event The call progress events that we will send to `status_callback`. Can be: `initiated`, `ringing`, `answered`, or `completed`.
                    # @param [String] timeout The timeout for a call when executing a Conference instruction.
                    # @param [Boolean] record Whether to record the participant and their conferences, including the time between conferences. Can be `true` or `false` and the default is `false`.
                    # @param [Boolean] muted Whether the agent is muted in the conference. Defaults to `false`.
                    # @param [String] beep Whether to play a notification beep when the participant joins or when to play a beep. Can be: `true`, `false`, `onEnter`, or `onExit`. The default value is `true`.
                    # @param [Boolean] start_conference_on_enter Whether to start the conference when the participant joins, if it has not already started. Can be: `true` or `false` and the default is `true`. If `false` and the conference has not started, the participant is muted and hears background music until another participant starts the conference.
                    # @param [Boolean] end_conference_on_exit Whether to end the conference when the agent leaves.
                    # @param [String] wait_url The URL we should call using the `wait_method` for the music to play while participants are waiting for the conference to start. The default value is the URL of our standard hold music. [Learn more about hold music](https://www.twilio.com/labs/twimlets/holdmusic).
                    # @param [String] wait_method The HTTP method we should use to call `wait_url`. Can be `GET` or `POST` and the default is `POST`. When using a static audio file, this should be `GET` so that we can cache the file.
                    # @param [Boolean] early_media Whether to allow an agent to hear the state of the outbound call, including ringing or disconnect messages. The default is `true`.
                    # @param [String] max_participants The maximum number of participants allowed in the conference. Can be a positive integer from `2` to `250`. The default value is `250`.
                    # @param [String] conference_status_callback The URL we should call using the `conference_status_callback_method` when the conference events in `conference_status_callback_event` occur. Only the value set by the first participant to join the conference is used. Subsequent `conference_status_callback` values are ignored.
                    # @param [String] conference_status_callback_method The HTTP method we should use to call `conference_status_callback`. Can be: `GET` or `POST` and defaults to `POST`.
                    # @param [Array[ConferenceEvent]] conference_status_callback_event The conference status events that we will send to `conference_status_callback`. Can be: `start`, `end`, `join`, `leave`, `mute`, `hold`, `speaker`.
                    # @param [String] conference_record Whether to record the conference the participant is joining or when to record the conference. Can be: `true`, `false`, `record-from-start`, and `do-not-record`. The default value is `false`.
                    # @param [String] conference_trim Whether to trim leading and trailing silence from your recorded conference audio files. Can be: `trim-silence` or `do-not-trim` and defaults to `trim-silence`.
                    # @param [String] recording_channels The recording channels for the final recording. Can be: `mono` or `dual` and the default is `mono`.
                    # @param [String] recording_status_callback The URL that we should call using the `recording_status_callback_method` when the recording status changes.
                    # @param [String] recording_status_callback_method The HTTP method we should use when we call `recording_status_callback`. Can be: `GET` or `POST` and defaults to `POST`.
                    # @param [String] conference_recording_status_callback The URL we should call using the `conference_recording_status_callback_method` when the conference recording is available.
                    # @param [String] conference_recording_status_callback_method The HTTP method we should use to call `conference_recording_status_callback`. Can be: `GET` or `POST` and defaults to `POST`.
                    # @param [String] region The [region](https://support.twilio.com/hc/en-us/articles/223132167-How-global-low-latency-routing-and-region-selection-work-for-conferences-and-Client-calls) where we should mix the recorded audio. Can be:`us1`, `us2`, `ie1`, `de1`, `sg1`, `br1`, `au1`, or `jp1`.
                    # @param [String] sip_auth_username The SIP username used for authentication.
                    # @param [String] sip_auth_password The SIP password for authentication.
                    # @param [Array[String]] dequeue_status_callback_event The call progress events sent via webhooks as a result of a Dequeue instruction.
                    # @param [String] post_work_activity_sid The new worker activity SID after executing a Conference instruction.
                    # @param [Boolean] end_conference_on_customer_exit Whether to end the conference when the customer leaves.
                    # @param [Boolean] beep_on_customer_entrance Whether to play a notification beep when the customer joins.
                    # @param [String] jitter_buffer_size The jitter buffer size for conference. Can be: `small`, `medium`, `large`, `off`.
                    # @param [String] if_match The If-Match HTTP request header
                    # @return [ReservationInstance] Updated ReservationInstance
                    def update(
                        reservation_status: :unset, 
                        worker_activity_sid: :unset, 
                        instruction: :unset, 
                        dequeue_post_work_activity_sid: :unset, 
                        dequeue_from: :unset, 
                        dequeue_record: :unset, 
                        dequeue_timeout: :unset, 
                        dequeue_to: :unset, 
                        dequeue_status_callback_url: :unset, 
                        call_from: :unset, 
                        call_record: :unset, 
                        call_timeout: :unset, 
                        call_to: :unset, 
                        call_url: :unset, 
                        call_status_callback_url: :unset, 
                        call_accept: :unset, 
                        redirect_call_sid: :unset, 
                        redirect_accept: :unset, 
                        redirect_url: :unset, 
                        to: :unset, 
                        from: :unset, 
                        status_callback: :unset, 
                        status_callback_method: :unset, 
                        status_callback_event: :unset, 
                        timeout: :unset, 
                        record: :unset, 
                        muted: :unset, 
                        beep: :unset, 
                        start_conference_on_enter: :unset, 
                        end_conference_on_exit: :unset, 
                        wait_url: :unset, 
                        wait_method: :unset, 
                        early_media: :unset, 
                        max_participants: :unset, 
                        conference_status_callback: :unset, 
                        conference_status_callback_method: :unset, 
                        conference_status_callback_event: :unset, 
                        conference_record: :unset, 
                        conference_trim: :unset, 
                        recording_channels: :unset, 
                        recording_status_callback: :unset, 
                        recording_status_callback_method: :unset, 
                        conference_recording_status_callback: :unset, 
                        conference_recording_status_callback_method: :unset, 
                        region: :unset, 
                        sip_auth_username: :unset, 
                        sip_auth_password: :unset, 
                        dequeue_status_callback_event: :unset, 
                        post_work_activity_sid: :unset, 
                        end_conference_on_customer_exit: :unset, 
                        beep_on_customer_entrance: :unset, 
                        jitter_buffer_size: :unset, 
                        if_match: :unset
                    )

                        data = Twilio::Values.of({
                            'ReservationStatus' => reservation_status,
                            'WorkerActivitySid' => worker_activity_sid,
                            'Instruction' => instruction,
                            'DequeuePostWorkActivitySid' => dequeue_post_work_activity_sid,
                            'DequeueFrom' => dequeue_from,
                            'DequeueRecord' => dequeue_record,
                            'DequeueTimeout' => dequeue_timeout,
                            'DequeueTo' => dequeue_to,
                            'DequeueStatusCallbackUrl' => dequeue_status_callback_url,
                            'CallFrom' => call_from,
                            'CallRecord' => call_record,
                            'CallTimeout' => call_timeout,
                            'CallTo' => call_to,
                            'CallUrl' => call_url,
                            'CallStatusCallbackUrl' => call_status_callback_url,
                            'CallAccept' => call_accept,
                            'RedirectCallSid' => redirect_call_sid,
                            'RedirectAccept' => redirect_accept,
                            'RedirectUrl' => redirect_url,
                            'To' => to,
                            'From' => from,
                            'StatusCallback' => status_callback,
                            'StatusCallbackMethod' => status_callback_method,
                            'StatusCallbackEvent' => Twilio.serialize_list(status_callback_event) { |e| e },
                            'Timeout' => timeout,
                            'Record' => record,
                            'Muted' => muted,
                            'Beep' => beep,
                            'StartConferenceOnEnter' => start_conference_on_enter,
                            'EndConferenceOnExit' => end_conference_on_exit,
                            'WaitUrl' => wait_url,
                            'WaitMethod' => wait_method,
                            'EarlyMedia' => early_media,
                            'MaxParticipants' => max_participants,
                            'ConferenceStatusCallback' => conference_status_callback,
                            'ConferenceStatusCallbackMethod' => conference_status_callback_method,
                            'ConferenceStatusCallbackEvent' => Twilio.serialize_list(conference_status_callback_event) { |e| e },
                            'ConferenceRecord' => conference_record,
                            'ConferenceTrim' => conference_trim,
                            'RecordingChannels' => recording_channels,
                            'RecordingStatusCallback' => recording_status_callback,
                            'RecordingStatusCallbackMethod' => recording_status_callback_method,
                            'ConferenceRecordingStatusCallback' => conference_recording_status_callback,
                            'ConferenceRecordingStatusCallbackMethod' => conference_recording_status_callback_method,
                            'Region' => region,
                            'SipAuthUsername' => sip_auth_username,
                            'SipAuthPassword' => sip_auth_password,
                            'DequeueStatusCallbackEvent' => Twilio.serialize_list(dequeue_status_callback_event) { |e| e },
                            'PostWorkActivitySid' => post_work_activity_sid,
                            'EndConferenceOnCustomerExit' => end_conference_on_customer_exit,
                            'BeepOnCustomerEntrance' => beep_on_customer_entrance,
                            'JitterBufferSize' => jitter_buffer_size,
                        })

                        headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', 'If-Match' => if_match, })
                        
                        
                        
                        
                        
                        payload = @version.update('POST', @uri, data: data, headers: headers)
                        ReservationInstance.new(
                            @version,
                            payload,
                            workspace_sid: @solution[:workspace_sid],
                            worker_sid: @solution[:worker_sid],
                            sid: @solution[:sid],
                        )
                    end


                    ##
                    # Provide a user friendly representation
                    def to_s
                        context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
                        "#<Twilio.Taskrouter.V1.ReservationContext #{context}>"
                    end

                    ##
                    # Provide a detailed, user friendly representation
                    def inspect
                        context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
                        "#<Twilio.Taskrouter.V1.ReservationContext #{context}>"
                    end
                end

                class ReservationPage < Page
                    ##
                    # Initialize the ReservationPage
                    # @param [Version] version Version that contains the resource
                    # @param [Response] response Response from the API
                    # @param [Hash] solution Path solution for the resource
                    # @return [ReservationPage] ReservationPage
                    def initialize(version, response, solution)
                        super(version, response)

                        # Path Solution
                        @solution = solution
                    end

                    ##
                    # Build an instance of ReservationInstance
                    # @param [Hash] payload Payload response from the API
                    # @return [ReservationInstance] ReservationInstance
                    def get_instance(payload)
                        ReservationInstance.new(@version, payload, workspace_sid: @solution[:workspace_sid], worker_sid: @solution[:worker_sid])
                    end

                    ##
                    # Provide a user friendly representation
                    def to_s
                        '<Twilio.Taskrouter.V1.ReservationPage>'
                    end
                end
                class ReservationInstance < InstanceResource
                    ##
                    # Initialize the ReservationInstance
                    # @param [Version] version Version that contains the resource
                    # @param [Hash] payload payload that contains response from Twilio
                    # @param [String] account_sid The SID of the
                    #   {Account}[https://www.twilio.com/docs/iam/api/account] that created this Reservation
                    #   resource.
                    # @param [String] sid The SID of the Call resource to fetch.
                    # @return [ReservationInstance] ReservationInstance
                    def initialize(version, payload , workspace_sid: nil, worker_sid: nil, sid: nil)
                        super(version)
                        
                        # Marshaled Properties
                        @properties = { 
                            'account_sid' => payload['account_sid'],
                            'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
                            'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
                            'reservation_status' => payload['reservation_status'],
                            'sid' => payload['sid'],
                            'task_sid' => payload['task_sid'],
                            'worker_name' => payload['worker_name'],
                            'worker_sid' => payload['worker_sid'],
                            'workspace_sid' => payload['workspace_sid'],
                            'url' => payload['url'],
                            'links' => payload['links'],
                        }

                        # Context
                        @instance_context = nil
                        @params = { 'workspace_sid' => workspace_sid  || @properties['workspace_sid']  ,'worker_sid' => worker_sid  || @properties['worker_sid']  ,'sid' => sid  || @properties['sid']  , }
                    end

                    ##
                    # Generate an instance context for the instance, the context is capable of
                    # performing various actions.  All instance actions are proxied to the context
                    # @return [ReservationContext] CallContext for this CallInstance
                    def context
                        unless @instance_context
                            @instance_context = ReservationContext.new(@version , @params['workspace_sid'], @params['worker_sid'], @params['sid'])
                        end
                        @instance_context
                    end
                    
                    ##
                    # @return [String] The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the WorkerReservation resource.
                    def account_sid
                        @properties['account_sid']
                    end
                    
                    ##
                    # @return [Time] The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
                    def date_created
                        @properties['date_created']
                    end
                    
                    ##
                    # @return [Time] The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
                    def date_updated
                        @properties['date_updated']
                    end
                    
                    ##
                    # @return [Status] 
                    def reservation_status
                        @properties['reservation_status']
                    end
                    
                    ##
                    # @return [String] The unique string that we created to identify the WorkerReservation resource.
                    def sid
                        @properties['sid']
                    end
                    
                    ##
                    # @return [String] The SID of the reserved Task resource.
                    def task_sid
                        @properties['task_sid']
                    end
                    
                    ##
                    # @return [String] The `friendly_name` of the Worker that is reserved.
                    def worker_name
                        @properties['worker_name']
                    end
                    
                    ##
                    # @return [String] The SID of the reserved Worker resource.
                    def worker_sid
                        @properties['worker_sid']
                    end
                    
                    ##
                    # @return [String] The SID of the Workspace that this worker is contained within.
                    def workspace_sid
                        @properties['workspace_sid']
                    end
                    
                    ##
                    # @return [String] The absolute URL of the WorkerReservation resource.
                    def url
                        @properties['url']
                    end
                    
                    ##
                    # @return [Hash] The URLs of related resources.
                    def links
                        @properties['links']
                    end
                    
                    ##
                    # Fetch the ReservationInstance
                    # @return [ReservationInstance] Fetched ReservationInstance
                    def fetch

                        context.fetch
                    end

                    ##
                    # Update the ReservationInstance
                    # @param [Status] reservation_status 
                    # @param [String] worker_activity_sid The new worker activity SID if rejecting a reservation.
                    # @param [String] instruction The assignment instruction for the reservation.
                    # @param [String] dequeue_post_work_activity_sid The SID of the Activity resource to start after executing a Dequeue instruction.
                    # @param [String] dequeue_from The caller ID of the call to the worker when executing a Dequeue instruction.
                    # @param [String] dequeue_record Whether to record both legs of a call when executing a Dequeue instruction or which leg to record.
                    # @param [String] dequeue_timeout The timeout for call when executing a Dequeue instruction.
                    # @param [String] dequeue_to The contact URI of the worker when executing a Dequeue instruction. Can be the URI of the Twilio Client, the SIP URI for Programmable SIP, or the [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone number, depending on the destination.
                    # @param [String] dequeue_status_callback_url The callback URL for completed call event when executing a Dequeue instruction.
                    # @param [String] call_from The Caller ID of the outbound call when executing a Call instruction.
                    # @param [String] call_record Whether to record both legs of a call when executing a Call instruction.
                    # @param [String] call_timeout The timeout for a call when executing a Call instruction.
                    # @param [String] call_to The contact URI of the worker when executing a Call instruction. Can be the URI of the Twilio Client, the SIP URI for Programmable SIP, or the [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone number, depending on the destination.
                    # @param [String] call_url TwiML URI executed on answering the worker's leg as a result of the Call instruction.
                    # @param [String] call_status_callback_url The URL to call for the completed call event when executing a Call instruction.
                    # @param [Boolean] call_accept Whether to accept a reservation when executing a Call instruction.
                    # @param [String] redirect_call_sid The Call SID of the call parked in the queue when executing a Redirect instruction.
                    # @param [Boolean] redirect_accept Whether the reservation should be accepted when executing a Redirect instruction.
                    # @param [String] redirect_url TwiML URI to redirect the call to when executing the Redirect instruction.
                    # @param [String] to The Contact URI of the worker when executing a Conference instruction. Can be the URI of the Twilio Client, the SIP URI for Programmable SIP, or the [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone number, depending on the destination.
                    # @param [String] from The caller ID of the call to the worker when executing a Conference instruction.
                    # @param [String] status_callback The URL we should call using the `status_callback_method` to send status information to your application.
                    # @param [String] status_callback_method The HTTP method we should use to call `status_callback`. Can be: `POST` or `GET` and the default is `POST`.
                    # @param [Array[CallStatus]] status_callback_event The call progress events that we will send to `status_callback`. Can be: `initiated`, `ringing`, `answered`, or `completed`.
                    # @param [String] timeout The timeout for a call when executing a Conference instruction.
                    # @param [Boolean] record Whether to record the participant and their conferences, including the time between conferences. Can be `true` or `false` and the default is `false`.
                    # @param [Boolean] muted Whether the agent is muted in the conference. Defaults to `false`.
                    # @param [String] beep Whether to play a notification beep when the participant joins or when to play a beep. Can be: `true`, `false`, `onEnter`, or `onExit`. The default value is `true`.
                    # @param [Boolean] start_conference_on_enter Whether to start the conference when the participant joins, if it has not already started. Can be: `true` or `false` and the default is `true`. If `false` and the conference has not started, the participant is muted and hears background music until another participant starts the conference.
                    # @param [Boolean] end_conference_on_exit Whether to end the conference when the agent leaves.
                    # @param [String] wait_url The URL we should call using the `wait_method` for the music to play while participants are waiting for the conference to start. The default value is the URL of our standard hold music. [Learn more about hold music](https://www.twilio.com/labs/twimlets/holdmusic).
                    # @param [String] wait_method The HTTP method we should use to call `wait_url`. Can be `GET` or `POST` and the default is `POST`. When using a static audio file, this should be `GET` so that we can cache the file.
                    # @param [Boolean] early_media Whether to allow an agent to hear the state of the outbound call, including ringing or disconnect messages. The default is `true`.
                    # @param [String] max_participants The maximum number of participants allowed in the conference. Can be a positive integer from `2` to `250`. The default value is `250`.
                    # @param [String] conference_status_callback The URL we should call using the `conference_status_callback_method` when the conference events in `conference_status_callback_event` occur. Only the value set by the first participant to join the conference is used. Subsequent `conference_status_callback` values are ignored.
                    # @param [String] conference_status_callback_method The HTTP method we should use to call `conference_status_callback`. Can be: `GET` or `POST` and defaults to `POST`.
                    # @param [Array[ConferenceEvent]] conference_status_callback_event The conference status events that we will send to `conference_status_callback`. Can be: `start`, `end`, `join`, `leave`, `mute`, `hold`, `speaker`.
                    # @param [String] conference_record Whether to record the conference the participant is joining or when to record the conference. Can be: `true`, `false`, `record-from-start`, and `do-not-record`. The default value is `false`.
                    # @param [String] conference_trim Whether to trim leading and trailing silence from your recorded conference audio files. Can be: `trim-silence` or `do-not-trim` and defaults to `trim-silence`.
                    # @param [String] recording_channels The recording channels for the final recording. Can be: `mono` or `dual` and the default is `mono`.
                    # @param [String] recording_status_callback The URL that we should call using the `recording_status_callback_method` when the recording status changes.
                    # @param [String] recording_status_callback_method The HTTP method we should use when we call `recording_status_callback`. Can be: `GET` or `POST` and defaults to `POST`.
                    # @param [String] conference_recording_status_callback The URL we should call using the `conference_recording_status_callback_method` when the conference recording is available.
                    # @param [String] conference_recording_status_callback_method The HTTP method we should use to call `conference_recording_status_callback`. Can be: `GET` or `POST` and defaults to `POST`.
                    # @param [String] region The [region](https://support.twilio.com/hc/en-us/articles/223132167-How-global-low-latency-routing-and-region-selection-work-for-conferences-and-Client-calls) where we should mix the recorded audio. Can be:`us1`, `us2`, `ie1`, `de1`, `sg1`, `br1`, `au1`, or `jp1`.
                    # @param [String] sip_auth_username The SIP username used for authentication.
                    # @param [String] sip_auth_password The SIP password for authentication.
                    # @param [Array[String]] dequeue_status_callback_event The call progress events sent via webhooks as a result of a Dequeue instruction.
                    # @param [String] post_work_activity_sid The new worker activity SID after executing a Conference instruction.
                    # @param [Boolean] end_conference_on_customer_exit Whether to end the conference when the customer leaves.
                    # @param [Boolean] beep_on_customer_entrance Whether to play a notification beep when the customer joins.
                    # @param [String] jitter_buffer_size The jitter buffer size for conference. Can be: `small`, `medium`, `large`, `off`.
                    # @param [String] if_match The If-Match HTTP request header
                    # @return [ReservationInstance] Updated ReservationInstance
                    def update(
                        reservation_status: :unset, 
                        worker_activity_sid: :unset, 
                        instruction: :unset, 
                        dequeue_post_work_activity_sid: :unset, 
                        dequeue_from: :unset, 
                        dequeue_record: :unset, 
                        dequeue_timeout: :unset, 
                        dequeue_to: :unset, 
                        dequeue_status_callback_url: :unset, 
                        call_from: :unset, 
                        call_record: :unset, 
                        call_timeout: :unset, 
                        call_to: :unset, 
                        call_url: :unset, 
                        call_status_callback_url: :unset, 
                        call_accept: :unset, 
                        redirect_call_sid: :unset, 
                        redirect_accept: :unset, 
                        redirect_url: :unset, 
                        to: :unset, 
                        from: :unset, 
                        status_callback: :unset, 
                        status_callback_method: :unset, 
                        status_callback_event: :unset, 
                        timeout: :unset, 
                        record: :unset, 
                        muted: :unset, 
                        beep: :unset, 
                        start_conference_on_enter: :unset, 
                        end_conference_on_exit: :unset, 
                        wait_url: :unset, 
                        wait_method: :unset, 
                        early_media: :unset, 
                        max_participants: :unset, 
                        conference_status_callback: :unset, 
                        conference_status_callback_method: :unset, 
                        conference_status_callback_event: :unset, 
                        conference_record: :unset, 
                        conference_trim: :unset, 
                        recording_channels: :unset, 
                        recording_status_callback: :unset, 
                        recording_status_callback_method: :unset, 
                        conference_recording_status_callback: :unset, 
                        conference_recording_status_callback_method: :unset, 
                        region: :unset, 
                        sip_auth_username: :unset, 
                        sip_auth_password: :unset, 
                        dequeue_status_callback_event: :unset, 
                        post_work_activity_sid: :unset, 
                        end_conference_on_customer_exit: :unset, 
                        beep_on_customer_entrance: :unset, 
                        jitter_buffer_size: :unset, 
                        if_match: :unset
                    )

                        context.update(
                            reservation_status: reservation_status, 
                            worker_activity_sid: worker_activity_sid, 
                            instruction: instruction, 
                            dequeue_post_work_activity_sid: dequeue_post_work_activity_sid, 
                            dequeue_from: dequeue_from, 
                            dequeue_record: dequeue_record, 
                            dequeue_timeout: dequeue_timeout, 
                            dequeue_to: dequeue_to, 
                            dequeue_status_callback_url: dequeue_status_callback_url, 
                            call_from: call_from, 
                            call_record: call_record, 
                            call_timeout: call_timeout, 
                            call_to: call_to, 
                            call_url: call_url, 
                            call_status_callback_url: call_status_callback_url, 
                            call_accept: call_accept, 
                            redirect_call_sid: redirect_call_sid, 
                            redirect_accept: redirect_accept, 
                            redirect_url: redirect_url, 
                            to: to, 
                            from: from, 
                            status_callback: status_callback, 
                            status_callback_method: status_callback_method, 
                            status_callback_event: status_callback_event, 
                            timeout: timeout, 
                            record: record, 
                            muted: muted, 
                            beep: beep, 
                            start_conference_on_enter: start_conference_on_enter, 
                            end_conference_on_exit: end_conference_on_exit, 
                            wait_url: wait_url, 
                            wait_method: wait_method, 
                            early_media: early_media, 
                            max_participants: max_participants, 
                            conference_status_callback: conference_status_callback, 
                            conference_status_callback_method: conference_status_callback_method, 
                            conference_status_callback_event: conference_status_callback_event, 
                            conference_record: conference_record, 
                            conference_trim: conference_trim, 
                            recording_channels: recording_channels, 
                            recording_status_callback: recording_status_callback, 
                            recording_status_callback_method: recording_status_callback_method, 
                            conference_recording_status_callback: conference_recording_status_callback, 
                            conference_recording_status_callback_method: conference_recording_status_callback_method, 
                            region: region, 
                            sip_auth_username: sip_auth_username, 
                            sip_auth_password: sip_auth_password, 
                            dequeue_status_callback_event: dequeue_status_callback_event, 
                            post_work_activity_sid: post_work_activity_sid, 
                            end_conference_on_customer_exit: end_conference_on_customer_exit, 
                            beep_on_customer_entrance: beep_on_customer_entrance, 
                            jitter_buffer_size: jitter_buffer_size, 
                            if_match: if_match, 
                        )
                    end

                    ##
                    # Provide a user friendly representation
                    def to_s
                        values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
                        "<Twilio.Taskrouter.V1.ReservationInstance #{values}>"
                    end

                    ##
                    # Provide a detailed, user friendly representation
                    def inspect
                        values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
                        "<Twilio.Taskrouter.V1.ReservationInstance #{values}>"
                    end
                end

             end
             end
            end
        end
    end
end


