##
# This code was generated by
# \ / _    _  _|   _  _
#  | (_)\/(_)(_|\/| |(/_  v1.0.0
#       /       /
#
# frozen_string_literal: true

module Twilio
  module REST
    class Preview < Domain
      class TrustedComms < Version
        ##
        # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
        class DeviceList < ListResource
          ##
          # Initialize the DeviceList
          # @param [Version] version Version that contains the resource
          # @return [DeviceList] DeviceList
          def initialize(version)
            super(version)

            # Path Solution
            @solution = {}
            @uri = "/Devices"
          end

          ##
          # Retrieve a single page of DeviceInstance records from the API.
          # Request is executed immediately.
          # @param [String] phone_number The end user Phone Number linked to the device,
          #   given in [E.164 format](https://en.wikipedia.org/wiki/E.164). The SDK or partner
          #   app is responsible of verifying this phone number veracity.
          # @param [String] push_token The Push Token for this Phone Number, linked to the
          #   correct SDK's application, certificate and keys.
          # @return [DeviceInstance] Newly created DeviceInstance
          def create(phone_number: nil, push_token: nil)
            data = Twilio::Values.of({'PhoneNumber' => phone_number, 'PushToken' => push_token, })

            payload = @version.create(
                'POST',
                @uri,
                data: data
            )

            DeviceInstance.new(@version, payload, )
          end

          ##
          # Provide a user friendly representation
          def to_s
            '#<Twilio.Preview.TrustedComms.DeviceList>'
          end
        end

        ##
        # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
        class DevicePage < Page
          ##
          # Initialize the DevicePage
          # @param [Version] version Version that contains the resource
          # @param [Response] response Response from the API
          # @param [Hash] solution Path solution for the resource
          # @return [DevicePage] DevicePage
          def initialize(version, response, solution)
            super(version, response)

            # Path Solution
            @solution = solution
          end

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

          ##
          # Provide a user friendly representation
          def to_s
            '<Twilio.Preview.TrustedComms.DevicePage>'
          end
        end

        ##
        # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
        class DeviceInstance < InstanceResource
          ##
          # Initialize the DeviceInstance
          # @param [Version] version Version that contains the resource
          # @param [Hash] payload payload that contains response from Twilio
          # @return [DeviceInstance] DeviceInstance
          def initialize(version, payload)
            super(version)

            # Marshaled Properties
            @properties = {
                'sid' => payload['sid'],
                'phone_number' => payload['phone_number'],
                'binding_sid' => payload['binding_sid'],
                'url' => payload['url'],
            }
          end

          ##
          # @return [String] A string that uniquely identifies this Device.
          def sid
            @properties['sid']
          end

          ##
          # @return [String] The end user Phone Number
          def phone_number
            @properties['phone_number']
          end

          ##
          # @return [String] Binding Sid.
          def binding_sid
            @properties['binding_sid']
          end

          ##
          # @return [String] The URL of this resource.
          def url
            @properties['url']
          end

          ##
          # Provide a user friendly representation
          def to_s
            "<Twilio.Preview.TrustedComms.DeviceInstance>"
          end

          ##
          # Provide a detailed, user friendly representation
          def inspect
            "<Twilio.Preview.TrustedComms.DeviceInstance>"
          end
        end
      end
    end
  end
end