##
#    This code was generated by
#    ___ _ _ _ _ _    _ ____    ____ ____ _    ____ ____ _  _ ____ ____ ____ ___ __   __
#     |  | | | | |    | |  | __ |  | |__| | __ | __ |___ |\ | |___ |__/ |__|  | |  | |__/
#     |  |_|_| | |___ | |__|    |__| |  | |    |__] |___ | \| |___ |  \ |  |  | |__| |  \
#
#    Twilio - Numbers
#    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 Numbers < NumbersBase
            class V1 < Version
                class SigningRequestConfigurationList < ListResource
                
                    ##
                    # Initialize the SigningRequestConfigurationList
                    # @param [Version] version Version that contains the resource
                    # @return [SigningRequestConfigurationList] SigningRequestConfigurationList
                    def initialize(version)
                        super(version)
                        # Path Solution
                        @solution = {  }
                        @uri = "/SigningRequest/Configuration"
                        
                    end
                    ##
                    # Create the SigningRequestConfigurationInstance
                    # @param [Object] body 
                    # @return [SigningRequestConfigurationInstance] Created SigningRequestConfigurationInstance
                    def create(body: :unset
                    )

                        headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
                        headers['Content-Type'] = 'application/json'
                        
                        
                        
                        
                        payload = @version.create('POST', @uri, headers: headers, data: body.to_json)
                        SigningRequestConfigurationInstance.new(
                            @version,
                            payload,
                        )
                    end

                
                    ##
                    # Lists SigningRequestConfigurationInstance records from the API as a list.
                    # Unlike stream(), this operation is eager and will load `limit` records into
                    # memory before returning.
                    # @param [String] country The country ISO code to apply this configuration, this is an optional field, Example: US, MX
                    # @param [String] product The product or service for which is requesting the signature, this is an optional field, Example: Porting, Hosting
                    # @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(country: :unset, product: :unset, limit: nil, page_size: nil)
                        self.stream(
                            country: country,
                            product: product,
                            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 [String] country The country ISO code to apply this configuration, this is an optional field, Example: US, MX
                    # @param [String] product The product or service for which is requesting the signature, this is an optional field, Example: Porting, Hosting
                    # @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(country: :unset, product: :unset, limit: nil, page_size: nil)
                        limits = @version.read_limits(limit, page_size)

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

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

                    ##
                    # When passed a block, yields SigningRequestConfigurationInstance 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 SigningRequestConfigurationInstance records from the API.
                    # Request is executed immediately.
                    # @param [String] country The country ISO code to apply this configuration, this is an optional field, Example: US, MX
                    # @param [String] product The product or service for which is requesting the signature, this is an optional field, Example: Porting, Hosting
                    # @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 SigningRequestConfigurationInstance
                    def page(country: :unset, product: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
                        params = Twilio::Values.of({
                            'Country' => country,
                            'Product' => product,
                            'PageToken' => page_token,
                            'Page' => page_number,
                            'PageSize' => page_size,
                        })
                        headers = Twilio::Values.of({})
                        
                        

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

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

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


                    # Provide a user friendly representation
                    def to_s
                        '#<Twilio.Numbers.V1.SigningRequestConfigurationList>'
                    end
                end

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

                        # Path Solution
                        @solution = solution
                    end

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

                    ##
                    # Provide a user friendly representation
                    def to_s
                        '<Twilio.Numbers.V1.SigningRequestConfigurationPage>'
                    end
                end
                class SigningRequestConfigurationInstance < InstanceResource
                    ##
                    # Initialize the SigningRequestConfigurationInstance
                    # @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 SigningRequestConfiguration
                    #   resource.
                    # @param [String] sid The SID of the Call resource to fetch.
                    # @return [SigningRequestConfigurationInstance] SigningRequestConfigurationInstance
                    def initialize(version, payload )
                        super(version)
                        
                        # Marshaled Properties
                        @properties = { 
                            'logo_sid' => payload['logo_sid'],
                            'friendly_name' => payload['friendly_name'],
                            'product' => payload['product'],
                            'country' => payload['country'],
                            'email_subject' => payload['email_subject'],
                            'email_message' => payload['email_message'],
                            'url_redirection' => payload['url_redirection'],
                            'url' => payload['url'],
                        }
                    end

                    
                    ##
                    # @return [String] The SID of the document  that includes the logo that will appear in the LOA. To upload documents follow the following guide: https://www.twilio.com/docs/phone-numbers/regulatory/getting-started/create-new-bundle-public-rest-apis#supporting-document-create 
                    def logo_sid
                        @properties['logo_sid']
                    end
                    
                    ##
                    # @return [String] This is the string that you assigned as a friendly name for describing the creation of the configuration.
                    def friendly_name
                        @properties['friendly_name']
                    end
                    
                    ##
                    # @return [String] The product or service for which is requesting the signature.
                    def product
                        @properties['product']
                    end
                    
                    ##
                    # @return [String] The country ISO code to apply the configuration.
                    def country
                        @properties['country']
                    end
                    
                    ##
                    # @return [String] Subject of the email that the end client will receive ex: “Twilio Hosting Request”, maximum length of 255 characters.
                    def email_subject
                        @properties['email_subject']
                    end
                    
                    ##
                    # @return [String] Content of the email that the end client will receive ex: “This is a Hosting request from Twilio, please check the document and sign it”, maximum length of 5,000 characters.
                    def email_message
                        @properties['email_message']
                    end
                    
                    ##
                    # @return [String] Url the end client will be redirected after signing a document.
                    def url_redirection
                        @properties['url_redirection']
                    end
                    
                    ##
                    # @return [String] 
                    def url
                        @properties['url']
                    end
                    
                    ##
                    # Provide a user friendly representation
                    def to_s
                        "<Twilio.Numbers.V1.SigningRequestConfigurationInstance>"
                    end

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

            end
        end
    end
end
