# bandwidth
#
# This file was automatically generated by APIMATIC v2.0
# ( https://apimatic.io ).

module Bandwidth
  # TwoFactorVerifyRequestSchema Model.
  class TwoFactorVerifyRequestSchema < BaseModel
    # The phone number to send the 2fa code to.
    # @return [String]
    attr_accessor :to

    # The application unique ID, obtained from Bandwidth.
    # @return [String]
    attr_accessor :application_id

    # An optional field to denote what scope or action the 2fa code is
    # addressing.  If not supplied, defaults to "2FA".
    # @return [String]
    attr_accessor :scope

    # The time period, in minutes, to validate the 2fa code.  By setting this to
    # 3 minutes, it will mean any code generated within the last 3 minutes are
    # still valid.  The valid range for expiration time is between 0 and 15
    # minutes, exclusively and inclusively, respectively.
    # @return [Float]
    attr_accessor :expiration_time_in_minutes

    # The generated 2fa code to check if valid
    # @return [String]
    attr_accessor :code

    # A mapping from model property names to API property names.
    def self.names
      @_hash = {} if @_hash.nil?
      @_hash['to'] = 'to'
      @_hash['application_id'] = 'applicationId'
      @_hash['scope'] = 'scope'
      @_hash['expiration_time_in_minutes'] = 'expirationTimeInMinutes'
      @_hash['code'] = 'code'
      @_hash
    end

    def initialize(to = nil,
                   application_id = nil,
                   expiration_time_in_minutes = nil,
                   code = nil,
                   scope = nil)
      @to = to
      @application_id = application_id
      @scope = scope
      @expiration_time_in_minutes = expiration_time_in_minutes
      @code = code
    end

    # Creates an instance of the object from a hash.
    def self.from_hash(hash)
      return nil unless hash

      # Extract variables from the hash.
      to = hash['to']
      application_id = hash['applicationId']
      expiration_time_in_minutes = hash['expirationTimeInMinutes']
      code = hash['code']
      scope = hash['scope']

      # Create object from extracted values.
      TwoFactorVerifyRequestSchema.new(to,
                                       application_id,
                                       expiration_time_in_minutes,
                                       code,
                                       scope)
    end
  end
end
