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

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

          ##
          # Retrieve a single page of BrandedCallInstance records from the API.
          # Request is executed immediately.
          # @param [String] from The phone number to use as the caller id, given in [E.164
          #   format](https://en.wikipedia.org/wiki/E.164). It must be a Twilio number that
          #   has been set up as a Branded Number in the Business Profile section for your
          #   account.
          # @param [String] to The terminating Phone Number, given in [E.164
          #   format](https://en.wikipedia.org/wiki/E.164).
          # @param [String] reason The business reason for this phone call that will appear
          #   in the terminating device's screen. Max 50 characters.
          # @param [String] call_sid The Call sid this Branded Call should link to.
          # @return [BrandedCallInstance] Newly created BrandedCallInstance
          def create(from: nil, to: nil, reason: nil, call_sid: :unset)
            data = Twilio::Values.of({'From' => from, 'To' => to, 'Reason' => reason, 'CallSid' => call_sid, })

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

            BrandedCallInstance.new(@version, payload, )
          end

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

            # Path Solution
            @solution = solution
          end

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

          ##
          # Provide a user friendly representation
          def to_s
            '<Twilio.Preview.TrustedComms.BrandedCallPage>'
          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 BrandedCallInstance < InstanceResource
          ##
          # Initialize the BrandedCallInstance
          # @param [Version] version Version that contains the resource
          # @param [Hash] payload payload that contains response from Twilio
          # @return [BrandedCallInstance] BrandedCallInstance
          def initialize(version, payload)
            super(version)

            # Marshaled Properties
            @properties = {
                'account_sid' => payload['account_sid'],
                'bg_color' => payload['bg_color'],
                'caller' => payload['caller'],
                'created_at' => Twilio.deserialize_iso8601_datetime(payload['created_at']),
                'font_color' => payload['font_color'],
                'from' => payload['from'],
                'logo' => payload['logo'],
                'reason' => payload['reason'],
                'sid' => payload['sid'],
                'status' => payload['status'],
                'to' => payload['to'],
                'url' => payload['url'],
                'use_case' => payload['use_case'],
            }
          end

          ##
          # @return [String] Account Sid.
          def account_sid
            @properties['account_sid']
          end

          ##
          # @return [String] Background color of the current phone call
          def bg_color
            @properties['bg_color']
          end

          ##
          # @return [String] Caller name of the current phone call
          def caller
            @properties['caller']
          end

          ##
          # @return [Time] The date this current phone call was created
          def created_at
            @properties['created_at']
          end

          ##
          # @return [String] Font color of the current phone call
          def font_color
            @properties['font_color']
          end

          ##
          # @return [String] The originating phone number
          def from
            @properties['from']
          end

          ##
          # @return [String] Logo URL of the caller
          def logo
            @properties['logo']
          end

          ##
          # @return [String] The business reason for this current phone call
          def reason
            @properties['reason']
          end

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

          ##
          # @return [String] The status of the current phone call
          def status
            @properties['status']
          end

          ##
          # @return [String] The terminating phone number
          def to
            @properties['to']
          end

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

          ##
          # @return [String] The use case for the current phone call
          def use_case
            @properties['use_case']
          end

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

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