##
# 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 CpsList < ListResource
          ##
          # Initialize the CpsList
          # @param [Version] version Version that contains the resource
          # @return [CpsList] CpsList
          def initialize(version)
            super(version)

            # Path Solution
            @solution = {}
          end

          ##
          # Provide a user friendly representation
          def to_s
            '#<Twilio.Preview.TrustedComms.CpsList>'
          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 CpsPage < Page
          ##
          # Initialize the CpsPage
          # @param [Version] version Version that contains the resource
          # @param [Response] response Response from the API
          # @param [Hash] solution Path solution for the resource
          # @return [CpsPage] CpsPage
          def initialize(version, response, solution)
            super(version, response)

            # Path Solution
            @solution = solution
          end

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

          ##
          # Provide a user friendly representation
          def to_s
            '<Twilio.Preview.TrustedComms.CpsPage>'
          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 CpsContext < InstanceContext
          ##
          # Initialize the CpsContext
          # @param [Version] version Version that contains the resource
          # @return [CpsContext] CpsContext
          def initialize(version)
            super(version)

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

          ##
          # Fetch a CpsInstance
          # @return [CpsInstance] Fetched CpsInstance
          def fetch
            params = Twilio::Values.of({})

            payload = @version.fetch(
                'GET',
                @uri,
                params,
            )

            CpsInstance.new(@version, payload, )
          end

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

          ##
          # Provide a detailed, user friendly representation
          def inspect
            context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
            "#<Twilio.Preview.TrustedComms.CpsContext #{context}>"
          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 CpsInstance < InstanceResource
          ##
          # Initialize the CpsInstance
          # @param [Version] version Version that contains the resource
          # @param [Hash] payload payload that contains response from Twilio
          # @return [CpsInstance] CpsInstance
          def initialize(version, payload)
            super(version)

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

            # Context
            @instance_context = nil
            @params = {}
          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 [CpsContext] CpsContext for this CpsInstance
          def context
            unless @instance_context
              @instance_context = CpsContext.new(@version, )
            end
            @instance_context
          end

          ##
          # @return [String] CPS URL of the phone number.
          def cps_url
            @properties['cps_url']
          end

          ##
          # @return [String] Phone number passed.
          def phone_number
            @properties['phone_number']
          end

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

          ##
          # Fetch a CpsInstance
          # @return [CpsInstance] Fetched CpsInstance
          def fetch
            context.fetch
          end

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

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