##
#    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 NewVerifyFactorList < ListResource
                
                    class VerifyPasskeysFactorRequest
                            # @param [id]: [String] A [base64url](https://base64.guru/standards/base64url) encoded representation of `rawId`.
                            # @param [raw_id]: [String] The globally unique identifier for this `PublicKeyCredential`.
                            # @param [authenticator_attachment]: [String] A string that indicates the mechanism by which the WebAuthn implementation is attached to the authenticator at the time the associated  `navigator.credentials.create()` or `navigator.credentials.get()` call completes.
                            # @param [type]: [String] The valid credential types supported by the API. The values of this enumeration are used for versioning the `AuthenticatorAssertion` and `AuthenticatorAttestation` structures according to the type of the authenticator.
                            # @param [response]: [NewVerifyFactorList.VerifyPasskeysFactorRequestResponse] 
                        attr_accessor :id, :raw_id, :authenticator_attachment, :type, :response
                        def initialize(payload)
                                @id = payload["id"]
                                @raw_id = payload["raw_id"]
                                @authenticator_attachment = payload["authenticator_attachment"]
                                @type = payload["type"]
                                @response = payload["response"]
                        end
                        def to_json(options = {})
                        {
                                "id": @id,
                                "rawId": @raw_id,
                                "authenticatorAttachment": @authenticator_attachment,
                                "type": @type,
                                "response": @response,
                        }.to_json(options)
                        end
                    end

                    class VerifyPasskeysFactorRequestResponse
                            # @param [attestation_object]: [String] The authenticator data and an attestation statement for a new key pair generated by the authenticator.
                            # @param [client_data_json]: [String] This property contains the JSON-compatible serialization of the data passed from the browser to the authenticator in order to generate this credential.
                            # @param [transports]: [Array<String>] An array of strings providing hints as to the methods the client could use to communicate with the relevant authenticator of the public key credential to retrieve.
                        attr_accessor :attestation_object, :client_data_json, :transports
                        def initialize(payload)
                                @attestation_object = payload["attestation_object"]
                                @client_data_json = payload["client_data_json"]
                                @transports = payload["transports"]
                        end
                        def to_json(options = {})
                        {
                                "attestationObject": @attestation_object,
                                "clientDataJSON": @client_data_json,
                                "transports": @transports,
                        }.to_json(options)
                        end
                    end


                    ##
                    # Initialize the NewVerifyFactorList
                    # @param [Version] version Version that contains the resource
                    # @return [NewVerifyFactorList] NewVerifyFactorList
                    def initialize(version, service_sid: nil)
                        super(version)
                        # Path Solution
                        @solution = { service_sid: service_sid }
                        @uri = "/Services/#{@solution[:service_sid]}/Passkeys/VerifyFactor"
                        
                    end
                    ##
                    # Update the NewVerifyFactorInstance
                    # @param [VerifyPasskeysFactorRequest] verify_passkeys_factor_request 
                    # @return [NewVerifyFactorInstance] Updated NewVerifyFactorInstance
                    def update(verify_passkeys_factor_request: nil
                    )

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

                


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

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

                        # Path Solution
                        @solution = solution
                    end

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

                    ##
                    # Provide a user friendly representation
                    def to_s
                        '<Twilio.Verify.V2.NewVerifyFactorPage>'
                    end
                end
                class NewVerifyFactorInstance < InstanceResource
                    ##
                    # Initialize the NewVerifyFactorInstance
                    # @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 NewVerifyFactor
                    #   resource.
                    # @param [String] sid The SID of the Call resource to fetch.
                    # @return [NewVerifyFactorInstance] NewVerifyFactorInstance
                    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'],
                            '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 [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] A human readable description of this resource, up to 64 characters.
                    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.NewVerifyFactorInstance>"
                    end

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

             end
            end
        end
    end
end


