##
#    This code was generated by
#    ___ _ _ _ _ _    _ ____    ____ ____ _    ____ ____ _  _ ____ ____ ____ ___ __   __
#     |  | | | | |    | |  | __ |  | |__| | __ | __ |___ |\ | |___ |__/ |__|  | |  | |__/
#     |  |_|_| | |___ | |__|    |__| |  | |    |__] |___ | \| |___ |  \ |  |  | |__| |  \
#
#    Twilio - Microvisor
#    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 Microvisor < MicrovisorBase
            class V1 < Version
                class AppContext < InstanceContext

                     class AppManifestList < ListResource
                
                    ##
                    # Initialize the AppManifestList
                    # @param [Version] version Version that contains the resource
                    # @return [AppManifestList] AppManifestList
                    def initialize(version, app_sid: nil)
                        super(version)
                        # Path Solution
                        @solution = { app_sid: app_sid }
                        
                        
                    end
                


                    # Provide a user friendly representation
                    def to_s
                        '#<Twilio.Microvisor.V1.AppManifestList>'
                    end
                end


                class AppManifestContext < InstanceContext
                    ##
                    # Initialize the AppManifestContext
                    # @param [Version] version Version that contains the resource
                    # @param [String] app_sid A 34-character string that uniquely identifies this App.
                    # @return [AppManifestContext] AppManifestContext
                    def initialize(version, app_sid)
                        super(version)

                        # Path Solution
                        @solution = { app_sid: app_sid,  }
                        @uri = "/Apps/#{@solution[:app_sid]}/Manifest"

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

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


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

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

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

                        # Path Solution
                        @solution = solution
                    end

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

                    ##
                    # Provide a user friendly representation
                    def to_s
                        '<Twilio.Microvisor.V1.AppManifestPage>'
                    end
                end
                class AppManifestInstance < InstanceResource
                    ##
                    # Initialize the AppManifestInstance
                    # @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 AppManifest
                    #   resource.
                    # @param [String] sid The SID of the Call resource to fetch.
                    # @return [AppManifestInstance] AppManifestInstance
                    def initialize(version, payload , app_sid: nil)
                        super(version)
                        
                        # Marshaled Properties
                        @properties = { 
                            'app_sid' => payload['app_sid'],
                            'hash' => payload['hash'],
                            'encoded_bytes' => payload['encoded_bytes'],
                            'url' => payload['url'],
                        }

                        # Context
                        @instance_context = nil
                        @params = { 'app_sid' => app_sid  || @properties['app_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 [AppManifestContext] CallContext for this CallInstance
                    def context
                        unless @instance_context
                            @instance_context = AppManifestContext.new(@version , @params['app_sid'])
                        end
                        @instance_context
                    end
                    
                    ##
                    # @return [String] A 34-character string that uniquely identifies this App.
                    def app_sid
                        @properties['app_sid']
                    end
                    
                    ##
                    # @return [String] App manifest hash represented as `hash_algorithm:hash_value`.
                    def hash
                        @properties['hash']
                    end
                    
                    ##
                    # @return [String] The base-64 encoded manifest
                    def encoded_bytes
                        @properties['encoded_bytes']
                    end
                    
                    ##
                    # @return [String] The absolute URL of this Manifest.
                    def url
                        @properties['url']
                    end
                    
                    ##
                    # Fetch the AppManifestInstance
                    # @return [AppManifestInstance] Fetched AppManifestInstance
                    def fetch

                        context.fetch
                    end

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

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

             end
            end
        end
    end
end