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


                    # Provide a user friendly representation
                    def to_s
                        '#<Twilio.Voice.V1.ArchivedCallList>'
                    end
                end


                class ArchivedCallContext < InstanceContext
                    ##
                    # Initialize the ArchivedCallContext
                    # @param [Version] version Version that contains the resource
                    # @param [Date] date The date of the Call in UTC.
                    # @param [String] sid The Twilio-provided Call SID that uniquely identifies the Call resource to delete
                    # @return [ArchivedCallContext] ArchivedCallContext
                    def initialize(version, date, sid)
                        super(version)

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

                        
                    end
                    ##
                    # Delete the ArchivedCallInstance
                    # @return [Boolean] True if delete succeeds, false otherwise
                    def delete

                        headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
                        
                        
                        
                        @version.delete('DELETE', @uri, headers: headers)
                    end


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

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

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

                        # Path Solution
                        @solution = solution
                    end

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

                    ##
                    # Provide a user friendly representation
                    def to_s
                        '<Twilio.Voice.V1.ArchivedCallPage>'
                    end
                end
                class ArchivedCallInstance < InstanceResource
                    ##
                    # Initialize the ArchivedCallInstance
                    # @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 ArchivedCall
                    #   resource.
                    # @param [String] sid The SID of the Call resource to fetch.
                    # @return [ArchivedCallInstance] ArchivedCallInstance
                    def initialize(version , date: nil, sid: nil)
                        super(version)
                        

                        # Context
                        @instance_context = nil
                        @params = { 'date' => date  || @properties['date']  ,'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 [ArchivedCallContext] CallContext for this CallInstance
                    def context
                        unless @instance_context
                            @instance_context = ArchivedCallContext.new(@version , @params['date'], @params['sid'])
                        end
                        @instance_context
                    end
                    
                    ##
                    # Delete the ArchivedCallInstance
                    # @return [Boolean] True if delete succeeds, false otherwise
                    def delete

                        context.delete
                    end

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

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

            end
        end
    end
end
