##
#    This code was generated by
#    ___ _ _ _ _ _    _ ____    ____ ____ _    ____ ____ _  _ ____ ____ ____ ___ __   __
#     |  | | | | |    | |  | __ |  | |__| | __ | __ |___ |\ | |___ |__/ |__|  | |  | |__/
#     |  |_|_| | |___ | |__|    |__| |  | |    |__] |___ | \| |___ |  \ |  |  | |__| |  \
#
#    Twilio - Marketplace
#    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 Marketplace < MarketplaceBase
            class V1 < Version
                class ModuleDataManagementList < ListResource
                
                    ##
                    # Initialize the ModuleDataManagementList
                    # @param [Version] version Version that contains the resource
                    # @return [ModuleDataManagementList] ModuleDataManagementList
                    def initialize(version)
                        super(version)
                        # Path Solution
                        @solution = {  }
                        
                        
                    end
                


                    # Provide a user friendly representation
                    def to_s
                        '#<Twilio.Marketplace.V1.ModuleDataManagementList>'
                    end
                end


                class ModuleDataManagementContext < InstanceContext
                    ##
                    # Initialize the ModuleDataManagementContext
                    # @param [Version] version Version that contains the resource
                    # @param [String] sid SID that uniquely identifies the Listing.
                    # @return [ModuleDataManagementContext] ModuleDataManagementContext
                    def initialize(version, sid)
                        super(version)

                        # Path Solution
                        @solution = { sid: sid,  }
                        @uri = "/Listing/#{@solution[:sid]}"

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

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

                    ##
                    # Update the ModuleDataManagementInstance
                    # @param [String] module_info A JSON object containing essential attributes that define a Listing.
                    # @param [String] description A JSON object describing the Listing. You can define the main body of the description, highlight key features or aspects of the Listing, and provide code samples for developers if applicable.
                    # @param [String] documentation A JSON object for providing comprehensive information, instructions, and resources related to the Listing.
                    # @param [String] policies A JSON object describing the Listing's privacy and legal policies. The maximum file size for Policies is 5MB.
                    # @param [String] support A JSON object containing information on how Marketplace users can obtain support for the Listing. Use this parameter to provide details such as contact information and support description.
                    # @param [String] configuration A JSON object for providing Listing-specific configuration. Contains button setup, notification URL, and more.
                    # @param [String] pricing A JSON object for providing Listing's purchase options.
                    # @return [ModuleDataManagementInstance] Updated ModuleDataManagementInstance
                    def update(
                        module_info: :unset, 
                        description: :unset, 
                        documentation: :unset, 
                        policies: :unset, 
                        support: :unset, 
                        configuration: :unset, 
                        pricing: :unset
                    )

                        data = Twilio::Values.of({
                            'ModuleInfo' => module_info,
                            'Description' => description,
                            'Documentation' => documentation,
                            'Policies' => policies,
                            'Support' => support,
                            'Configuration' => configuration,
                            'Pricing' => pricing,
                        })

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


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

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

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

                        # Path Solution
                        @solution = solution
                    end

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

                    ##
                    # Provide a user friendly representation
                    def to_s
                        '<Twilio.Marketplace.V1.ModuleDataManagementPage>'
                    end
                end
                class ModuleDataManagementInstance < InstanceResource
                    ##
                    # Initialize the ModuleDataManagementInstance
                    # @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 ModuleDataManagement
                    #   resource.
                    # @param [String] sid The SID of the Call resource to fetch.
                    # @return [ModuleDataManagementInstance] ModuleDataManagementInstance
                    def initialize(version, payload , sid: nil)
                        super(version)
                        
                        # Marshaled Properties
                        @properties = { 
                            'url' => payload['url'],
                            'sid' => payload['sid'],
                            'description' => payload['description'],
                            'support' => payload['support'],
                            'policies' => payload['policies'],
                            'module_info' => payload['module_info'],
                            'documentation' => payload['documentation'],
                            'configuration' => payload['configuration'],
                            'pricing' => payload['pricing'],
                            'listings' => payload['listings'],
                        }

                        # Context
                        @instance_context = nil
                        @params = { '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 [ModuleDataManagementContext] CallContext for this CallInstance
                    def context
                        unless @instance_context
                            @instance_context = ModuleDataManagementContext.new(@version , @params['sid'])
                        end
                        @instance_context
                    end
                    
                    ##
                    # @return [String] URL to query the subresource.
                    def url
                        @properties['url']
                    end
                    
                    ##
                    # @return [String] ModuleSid that identifies this Listing.
                    def sid
                        @properties['sid']
                    end
                    
                    ##
                    # @return [Hash] A JSON object describing the module and is displayed under the Description tab of the Module detail page. You can define the main body of the description, highlight key features or aspects of the module and if applicable, provide code samples for developers
                    def description
                        @properties['description']
                    end
                    
                    ##
                    # @return [Hash] A JSON object containing information on how customers can obtain support for the module. Use this parameter to provide details such as contact information and support description.
                    def support
                        @properties['support']
                    end
                    
                    ##
                    # @return [Hash] A JSON object describing the module's privacy and legal policies and is displayed under the Policies tab of the Module detail page. The maximum file size for Policies is 5MB
                    def policies
                        @properties['policies']
                    end
                    
                    ##
                    # @return [Hash] A JSON object containing essential attributes that define a module. This information is presented on the Module detail page in the Twilio Marketplace Catalog. You can pass the following attributes in the JSON object
                    def module_info
                        @properties['module_info']
                    end
                    
                    ##
                    # @return [Hash] A JSON object for providing comprehensive information, instructions, and resources related to the module
                    def documentation
                        @properties['documentation']
                    end
                    
                    ##
                    # @return [Hash] A JSON object for providing listing specific configuration. Contains button setup, notification url, among others.
                    def configuration
                        @properties['configuration']
                    end
                    
                    ##
                    # @return [Hash] A JSON object for providing Listing specific pricing information.
                    def pricing
                        @properties['pricing']
                    end
                    
                    ##
                    # @return [Array<Hash>] 
                    def listings
                        @properties['listings']
                    end
                    
                    ##
                    # Fetch the ModuleDataManagementInstance
                    # @return [ModuleDataManagementInstance] Fetched ModuleDataManagementInstance
                    def fetch

                        context.fetch
                    end

                    ##
                    # Update the ModuleDataManagementInstance
                    # @param [String] module_info A JSON object containing essential attributes that define a Listing.
                    # @param [String] description A JSON object describing the Listing. You can define the main body of the description, highlight key features or aspects of the Listing, and provide code samples for developers if applicable.
                    # @param [String] documentation A JSON object for providing comprehensive information, instructions, and resources related to the Listing.
                    # @param [String] policies A JSON object describing the Listing's privacy and legal policies. The maximum file size for Policies is 5MB.
                    # @param [String] support A JSON object containing information on how Marketplace users can obtain support for the Listing. Use this parameter to provide details such as contact information and support description.
                    # @param [String] configuration A JSON object for providing Listing-specific configuration. Contains button setup, notification URL, and more.
                    # @param [String] pricing A JSON object for providing Listing's purchase options.
                    # @return [ModuleDataManagementInstance] Updated ModuleDataManagementInstance
                    def update(
                        module_info: :unset, 
                        description: :unset, 
                        documentation: :unset, 
                        policies: :unset, 
                        support: :unset, 
                        configuration: :unset, 
                        pricing: :unset
                    )

                        context.update(
                            module_info: module_info, 
                            description: description, 
                            documentation: documentation, 
                            policies: policies, 
                            support: support, 
                            configuration: configuration, 
                            pricing: pricing, 
                        )
                    end

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

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

            end
        end
    end
end
