##
#    This code was generated by
#    ___ _ _ _ _ _    _ ____    ____ ____ _    ____ ____ _  _ ____ ____ ____ ___ __   __
#     |  | | | | |    | |  | __ |  | |__| | __ | __ |___ |\ | |___ |__/ |__|  | |  | |__/
#     |  |_|_| | |___ | |__|    |__| |  | |    |__] |___ | \| |___ |  \ |  |  | |__| |  \
#
#    Twilio - Conversations
#    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 Conversations < ConversationsBase
            class V1 < Version
                class ConversationWithParticipantsList < ListResource
                
                    ##
                    # Initialize the ConversationWithParticipantsList
                    # @param [Version] version Version that contains the resource
                    # @return [ConversationWithParticipantsList] ConversationWithParticipantsList
                    def initialize(version)
                        super(version)
                        # Path Solution
                        @solution = {  }
                        @uri = "/ConversationWithParticipants"
                        
                    end
                    ##
                    # Create the ConversationWithParticipantsInstance
                    # @param [String] friendly_name The human-readable name of this conversation, limited to 256 characters. Optional.
                    # @param [String] unique_name An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL.
                    # @param [Time] date_created The date that this resource was created.
                    # @param [Time] date_updated The date that this resource was last updated.
                    # @param [String] messaging_service_sid The unique ID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) this conversation belongs to.
                    # @param [String] attributes An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified.  **Note** that if the attributes are not set \\\"{}\\\" will be returned.
                    # @param [State] state 
                    # @param [String] timers_inactive ISO8601 duration when conversation will be switched to `inactive` state. Minimum value for this timer is 1 minute.
                    # @param [String] timers_closed ISO8601 duration when conversation will be switched to `closed` state. Minimum value for this timer is 10 minutes.
                    # @param [String] bindings_email_address The default email address that will be used when sending outbound emails in this conversation.
                    # @param [String] bindings_email_name The default name that will be used when sending outbound emails in this conversation.
                    # @param [Array[String]] participant The participant to be added to the conversation in JSON format. The JSON object attributes are as parameters in [Participant Resource](https://www.twilio.com/docs/conversations/api/conversation-participant-resource). The maximum number of participants that can be added in a single request is 10.
                    # @param [ConversationWithParticipantsEnumWebhookEnabledType] x_twilio_webhook_enabled The X-Twilio-Webhook-Enabled HTTP request header
                    # @return [ConversationWithParticipantsInstance] Created ConversationWithParticipantsInstance
                    def create(
                        friendly_name: :unset, 
                        unique_name: :unset, 
                        date_created: :unset, 
                        date_updated: :unset, 
                        messaging_service_sid: :unset, 
                        attributes: :unset, 
                        state: :unset, 
                        timers_inactive: :unset, 
                        timers_closed: :unset, 
                        bindings_email_address: :unset, 
                        bindings_email_name: :unset, 
                        participant: :unset, 
                        x_twilio_webhook_enabled: :unset
                    )

                        data = Twilio::Values.of({
                            'FriendlyName' => friendly_name,
                            'UniqueName' => unique_name,
                            'DateCreated' => Twilio.serialize_iso8601_datetime(date_created),
                            'DateUpdated' => Twilio.serialize_iso8601_datetime(date_updated),
                            'MessagingServiceSid' => messaging_service_sid,
                            'Attributes' => attributes,
                            'State' => state,
                            'Timers.Inactive' => timers_inactive,
                            'Timers.Closed' => timers_closed,
                            'Bindings.Email.Address' => bindings_email_address,
                            'Bindings.Email.Name' => bindings_email_name,
                            'Participant' => Twilio.serialize_list(participant) { |e| e },
                        })

                        headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', 'X-Twilio-Webhook-Enabled' => x_twilio_webhook_enabled, })
                        
                        
                        
                        
                        
                        payload = @version.create('POST', @uri, data: data, headers: headers)
                        ConversationWithParticipantsInstance.new(
                            @version,
                            payload,
                        )
                    end

                


                    # Provide a user friendly representation
                    def to_s
                        '#<Twilio.Conversations.V1.ConversationWithParticipantsList>'
                    end
                end

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

                        # Path Solution
                        @solution = solution
                    end

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

                    ##
                    # Provide a user friendly representation
                    def to_s
                        '<Twilio.Conversations.V1.ConversationWithParticipantsPage>'
                    end
                end
                class ConversationWithParticipantsInstance < InstanceResource
                    ##
                    # Initialize the ConversationWithParticipantsInstance
                    # @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 ConversationWithParticipants
                    #   resource.
                    # @param [String] sid The SID of the Call resource to fetch.
                    # @return [ConversationWithParticipantsInstance] ConversationWithParticipantsInstance
                    def initialize(version, payload )
                        super(version)
                        
                        # Marshaled Properties
                        @properties = { 
                            'account_sid' => payload['account_sid'],
                            'chat_service_sid' => payload['chat_service_sid'],
                            'messaging_service_sid' => payload['messaging_service_sid'],
                            'sid' => payload['sid'],
                            'friendly_name' => payload['friendly_name'],
                            'unique_name' => payload['unique_name'],
                            'attributes' => payload['attributes'],
                            'state' => payload['state'],
                            'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
                            'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
                            'timers' => payload['timers'],
                            'links' => payload['links'],
                            'bindings' => payload['bindings'],
                            'url' => payload['url'],
                        }
                    end

                    
                    ##
                    # @return [String] The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation.
                    def account_sid
                        @properties['account_sid']
                    end
                    
                    ##
                    # @return [String] The unique ID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) this conversation belongs to.
                    def chat_service_sid
                        @properties['chat_service_sid']
                    end
                    
                    ##
                    # @return [String] The unique ID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) this conversation belongs to.
                    def messaging_service_sid
                        @properties['messaging_service_sid']
                    end
                    
                    ##
                    # @return [String] A 34 character string that uniquely identifies this resource.
                    def sid
                        @properties['sid']
                    end
                    
                    ##
                    # @return [String] The human-readable name of this conversation, limited to 256 characters. Optional.
                    def friendly_name
                        @properties['friendly_name']
                    end
                    
                    ##
                    # @return [String] An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL.
                    def unique_name
                        @properties['unique_name']
                    end
                    
                    ##
                    # @return [String] An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified.  **Note** that if the attributes are not set \"{}\" will be returned.
                    def attributes
                        @properties['attributes']
                    end
                    
                    ##
                    # @return [State] 
                    def state
                        @properties['state']
                    end
                    
                    ##
                    # @return [Time] The date that this resource was created.
                    def date_created
                        @properties['date_created']
                    end
                    
                    ##
                    # @return [Time] The date that this resource was last updated.
                    def date_updated
                        @properties['date_updated']
                    end
                    
                    ##
                    # @return [Hash] Timer date values representing state update for this conversation.
                    def timers
                        @properties['timers']
                    end
                    
                    ##
                    # @return [Hash] Contains absolute URLs to access the [participants](https://www.twilio.com/docs/conversations/api/conversation-participant-resource), [messages](https://www.twilio.com/docs/conversations/api/conversation-message-resource) and [webhooks](https://www.twilio.com/docs/conversations/api/conversation-scoped-webhook-resource) of this conversation.
                    def links
                        @properties['links']
                    end
                    
                    ##
                    # @return [Hash] 
                    def bindings
                        @properties['bindings']
                    end
                    
                    ##
                    # @return [String] An absolute API resource URL for this conversation.
                    def url
                        @properties['url']
                    end
                    
                    ##
                    # Provide a user friendly representation
                    def to_s
                        "<Twilio.Conversations.V1.ConversationWithParticipantsInstance>"
                    end

                    ##
                    # Provide a detailed, user friendly representation
                    def inspect
                        "<Twilio.Conversations.V1.ConversationWithParticipantsInstance>"
                    end
                end

            end
        end
    end
end
