##
#    This code was generated by
#    ___ _ _ _ _ _    _ ____    ____ ____ _    ____ ____ _  _ ____ ____ ____ ___ __   __
#     |  | | | | |    | |  | __ |  | |__| | __ | __ |___ |\ | |___ |__/ |__|  | |  | |__/
#     |  |_|_| | |___ | |__|    |__| |  | |    |__] |___ | \| |___ |  \ |  |  | |__| |  \
#
#    Twilio - Verify
#    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 Verify < VerifyBase
            class V2 < Version
                class ServiceContext < InstanceContext

                     class NewFactorList < ListResource
                
                    class CreateNewPasskeysFactorRequest
                            # @param [friendly_name]: [String] 
                            # @param [identity]: [String] 
                            # @param [config]: [NewFactorList.CreateNewPasskeysFactorRequestConfig] 
                        attr_accessor :friendly_name, :identity, :config
                        def initialize(payload)
                                @friendly_name = payload["friendly_name"]
                                @identity = payload["identity"]
                                @config = payload["config"]
                        end
                        def to_json(options = {})
                        {
                                "friendly_name": @friendly_name,
                                "identity": @identity,
                                "config": @config,
                        }.to_json(options)
                        end
                    end

                    class CreateNewPasskeysFactorRequestConfig
                            # @param [relying_party]: [NewFactorList.CreateNewPasskeysFactorRequestConfigRelyingParty] 
                            # @param [authenticator_attachment]: [String] 
                            # @param [discoverable_credentials]: [String] 
                            # @param [user_verification]: [String] 
                        attr_accessor :relying_party, :authenticator_attachment, :discoverable_credentials, :user_verification
                        def initialize(payload)
                                @relying_party = payload["relying_party"]
                                @authenticator_attachment = payload["authenticator_attachment"]
                                @discoverable_credentials = payload["discoverable_credentials"]
                                @user_verification = payload["user_verification"]
                        end
                        def to_json(options = {})
                        {
                                "relying_party": @relying_party,
                                "authenticator_attachment": @authenticator_attachment,
                                "discoverable_credentials": @discoverable_credentials,
                                "user_verification": @user_verification,
                        }.to_json(options)
                        end
                    end

                    class CreateNewPasskeysFactorRequestConfigRelyingParty
                            # @param [id]: [String] 
                            # @param [name]: [String] 
                            # @param [origins]: [Array<String>] 
                        attr_accessor :id, :name, :origins
                        def initialize(payload)
                                @id = payload["id"]
                                @name = payload["name"]
                                @origins = payload["origins"]
                        end
                        def to_json(options = {})
                        {
                                "id": @id,
                                "name": @name,
                                "origins": @origins,
                        }.to_json(options)
                        end
                    end


                    ##
                    # Initialize the NewFactorList
                    # @param [Version] version Version that contains the resource
                    # @return [NewFactorList] NewFactorList
                    def initialize(version, service_sid: nil)
                        super(version)
                        # Path Solution
                        @solution = { service_sid: service_sid }
                        @uri = "/Services/#{@solution[:service_sid]}/Passkeys/Factors"
                        
                    end
                    ##
                    # Create the NewFactorInstance
                    # @param [CreateNewPasskeysFactorRequest] create_new_passkeys_factor_request 
                    # @return [NewFactorInstance] Created NewFactorInstance
                    def create(create_new_passkeys_factor_request: nil
                    )

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

                


                    # Provide a user friendly representation
                    def to_s
                        '#<Twilio.Verify.V2.NewFactorList>'
                    end
                end

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

                        # Path Solution
                        @solution = solution
                    end

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

                    ##
                    # Provide a user friendly representation
                    def to_s
                        '<Twilio.Verify.V2.NewFactorPage>'
                    end
                end
                class NewFactorInstance < InstanceResource
                    ##
                    # Initialize the NewFactorInstance
                    # @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 NewFactor
                    #   resource.
                    # @param [String] sid The SID of the Call resource to fetch.
                    # @return [NewFactorInstance] NewFactorInstance
                    def initialize(version, payload , service_sid: nil)
                        super(version)
                        
                        # Marshaled Properties
                        @properties = { 
                            'sid' => payload['sid'],
                            'account_sid' => payload['account_sid'],
                            'service_sid' => payload['service_sid'],
                            'entity_sid' => payload['entity_sid'],
                            'identity' => payload['identity'],
                            'binding' => payload['binding'],
                            'options' => payload['options'],
                            'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
                            'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
                            'friendly_name' => payload['friendly_name'],
                            'status' => payload['status'],
                            'factor_type' => payload['factor_type'],
                            'config' => payload['config'],
                            'metadata' => payload['metadata'],
                            'url' => payload['url'],
                        }
                    end

                    
                    ##
                    # @return [String] A 34 character string that uniquely identifies this Factor.
                    def sid
                        @properties['sid']
                    end
                    
                    ##
                    # @return [String] The unique SID identifier of the Account.
                    def account_sid
                        @properties['account_sid']
                    end
                    
                    ##
                    # @return [String] The unique SID identifier of the Service.
                    def service_sid
                        @properties['service_sid']
                    end
                    
                    ##
                    # @return [String] The unique SID identifier of the Entity.
                    def entity_sid
                        @properties['entity_sid']
                    end
                    
                    ##
                    # @return [String] Customer unique identity for the Entity owner of the Factor.
                    def identity
                        @properties['identity']
                    end
                    
                    ##
                    # @return [Hash] Contains the `factor_type` specific secret and metadata. The Binding property is ONLY returned upon Factor creation.
                    def binding
                        @properties['binding']
                    end
                    
                    ##
                    # @return [Hash] 
                    def options
                        @properties['options']
                    end
                    
                    ##
                    # @return [Time] The date that this Factor was created, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
                    def date_created
                        @properties['date_created']
                    end
                    
                    ##
                    # @return [Time] The date that this Factor was updated, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
                    def date_updated
                        @properties['date_updated']
                    end
                    
                    ##
                    # @return [String] The friendly name of this Factor. This can be any string up to 64 characters, meant for humans to distinguish between Factors.
                    def friendly_name
                        @properties['friendly_name']
                    end
                    
                    ##
                    # @return [String] The Status of this Factor. One of `unverified` or `verified`.
                    def status
                        @properties['status']
                    end
                    
                    ##
                    # @return [String] The Type of this Factor. Currently `push` and `totp` are supported.
                    def factor_type
                        @properties['factor_type']
                    end
                    
                    ##
                    # @return [Hash] An object that contains configurations specific to a `factor_type`.
                    def config
                        @properties['config']
                    end
                    
                    ##
                    # @return [Hash] Custom metadata associated with the factor.
                    def metadata
                        @properties['metadata']
                    end
                    
                    ##
                    # @return [String] The URL of this resource.
                    def url
                        @properties['url']
                    end
                    
                    ##
                    # Provide a user friendly representation
                    def to_s
                        "<Twilio.Verify.V2.NewFactorInstance>"
                    end

                    ##
                    # Provide a detailed, user friendly representation
                    def inspect
                        "<Twilio.Verify.V2.NewFactorInstance>"
                    end
                end

             end
            end
        end
    end
end


