# Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.

# typed: true
# frozen_string_literal: true

require 'sorbet-runtime'
require 'faraday'

module OpenApiSDK
  module Operations
    GET_PIN_SERVERS = [
      'https://plex.tv/api/v2'
    ].freeze

    class GetPinRequest < ::OpenApiSDK::Utils::FieldAugmented
      extend T::Sig

      # Plex Authentication Token
      field :x_plex_client_identifier, String, { 'header': { 'field_name': 'X-Plex-Client-Identifier', 'style': 'simple', 'explode': false } }
      # Determines the kind of code returned by the API call
      # Strong codes are used for Pin authentication flows
      # Non-Strong codes are used for `Plex.tv/link`
      # 
      field :strong, T.nilable(T::Boolean), { 'query_param': { 'field_name': 'strong', 'style': 'form', 'explode': true } }


      sig { params(x_plex_client_identifier: String, strong: T.nilable(T::Boolean)).void }
      def initialize(x_plex_client_identifier: nil, strong: nil)
        @x_plex_client_identifier = x_plex_client_identifier
        @strong = strong
      end
    end


    class GetPinErrors < ::OpenApiSDK::Utils::FieldAugmented
      extend T::Sig


      field :code, T.nilable(Float), { 'format_json': { 'letter_case': ::OpenApiSDK::Utils.field_name('code') } }

      field :message, T.nilable(String), { 'format_json': { 'letter_case': ::OpenApiSDK::Utils.field_name('message') } }

      field :status, T.nilable(Float), { 'format_json': { 'letter_case': ::OpenApiSDK::Utils.field_name('status') } }


      sig { params(code: T.nilable(Float), message: T.nilable(String), status: T.nilable(Float)).void }
      def initialize(code: nil, message: nil, status: nil)
        @code = code
        @message = message
        @status = status
      end
    end

    # X-Plex-Client-Identifier is missing
    class GetPinPlexTvResponseBody < ::OpenApiSDK::Utils::FieldAugmented
      extend T::Sig


      field :errors, T.nilable(T::Array[Operations::GetPinErrors]), { 'format_json': { 'letter_case': ::OpenApiSDK::Utils.field_name('errors') } }


      sig { params(errors: T.nilable(T::Array[Operations::GetPinErrors])).void }
      def initialize(errors: nil)
        @errors = errors
      end
    end


    class Location < ::OpenApiSDK::Utils::FieldAugmented
      extend T::Sig


      field :city, T.nilable(String), { 'format_json': { 'letter_case': ::OpenApiSDK::Utils.field_name('city') } }

      field :code, T.nilable(String), { 'format_json': { 'letter_case': ::OpenApiSDK::Utils.field_name('code') } }

      field :continent_code, T.nilable(String), { 'format_json': { 'letter_case': ::OpenApiSDK::Utils.field_name('continent_code') } }

      field :coordinates, T.nilable(String), { 'format_json': { 'letter_case': ::OpenApiSDK::Utils.field_name('coordinates') } }

      field :country, T.nilable(String), { 'format_json': { 'letter_case': ::OpenApiSDK::Utils.field_name('country') } }

      field :european_union_member, T.nilable(T::Boolean), { 'format_json': { 'letter_case': ::OpenApiSDK::Utils.field_name('european_union_member') } }

      field :in_privacy_restricted_country, T.nilable(T::Boolean), { 'format_json': { 'letter_case': ::OpenApiSDK::Utils.field_name('in_privacy_restricted_country') } }

      field :postal_code, T.nilable(Float), { 'format_json': { 'letter_case': ::OpenApiSDK::Utils.field_name('postal_code') } }

      field :subdivisions, T.nilable(String), { 'format_json': { 'letter_case': ::OpenApiSDK::Utils.field_name('subdivisions') } }

      field :time_zone, T.nilable(String), { 'format_json': { 'letter_case': ::OpenApiSDK::Utils.field_name('time_zone') } }


      sig { params(city: T.nilable(String), code: T.nilable(String), continent_code: T.nilable(String), coordinates: T.nilable(String), country: T.nilable(String), european_union_member: T.nilable(T::Boolean), in_privacy_restricted_country: T.nilable(T::Boolean), postal_code: T.nilable(Float), subdivisions: T.nilable(String), time_zone: T.nilable(String)).void }
      def initialize(city: nil, code: nil, continent_code: nil, coordinates: nil, country: nil, european_union_member: nil, in_privacy_restricted_country: nil, postal_code: nil, subdivisions: nil, time_zone: nil)
        @city = city
        @code = code
        @continent_code = continent_code
        @coordinates = coordinates
        @country = country
        @european_union_member = european_union_member
        @in_privacy_restricted_country = in_privacy_restricted_country
        @postal_code = postal_code
        @subdivisions = subdivisions
        @time_zone = time_zone
      end
    end

    # The Pin
    class GetPinResponseBody < ::OpenApiSDK::Utils::FieldAugmented
      extend T::Sig


      field :auth_token, T.nilable(String), { 'format_json': { 'letter_case': ::OpenApiSDK::Utils.field_name('authToken') } }

      field :client_identifier, T.nilable(String), { 'format_json': { 'letter_case': ::OpenApiSDK::Utils.field_name('clientIdentifier') } }

      field :code, T.nilable(String), { 'format_json': { 'letter_case': ::OpenApiSDK::Utils.field_name('code') } }

      field :created_at, T.nilable(DateTime), { 'format_json': { 'letter_case': ::OpenApiSDK::Utils.field_name('createdAt'), 'decoder': Utils.datetime_from_iso_format(true) } }

      field :expires_at, T.nilable(DateTime), { 'format_json': { 'letter_case': ::OpenApiSDK::Utils.field_name('expiresAt'), 'decoder': Utils.datetime_from_iso_format(true) } }

      field :expires_in, T.nilable(Float), { 'format_json': { 'letter_case': ::OpenApiSDK::Utils.field_name('expiresIn') } }
      # PinID for use with authentication
      field :id, T.nilable(Float), { 'format_json': { 'letter_case': ::OpenApiSDK::Utils.field_name('id') } }

      field :location, T.nilable(Operations::Location), { 'format_json': { 'letter_case': ::OpenApiSDK::Utils.field_name('location') } }

      field :new_registration, T.nilable(String), { 'format_json': { 'letter_case': ::OpenApiSDK::Utils.field_name('newRegistration') } }

      field :product, T.nilable(String), { 'format_json': { 'letter_case': ::OpenApiSDK::Utils.field_name('product') } }
      # a link to a QR code hosted on plex.tv 
      # The QR code redirects to the relevant `plex.tv/link` authentication page
      # Which then prompts the user for the 4 Digit Link Pin
      # 
      field :qr, T.nilable(String), { 'format_json': { 'letter_case': ::OpenApiSDK::Utils.field_name('qr') } }

      field :trusted, T.nilable(T::Boolean), { 'format_json': { 'letter_case': ::OpenApiSDK::Utils.field_name('trusted') } }


      sig { params(auth_token: T.nilable(String), client_identifier: T.nilable(String), code: T.nilable(String), created_at: T.nilable(DateTime), expires_at: T.nilable(DateTime), expires_in: T.nilable(Float), id: T.nilable(Float), location: T.nilable(Operations::Location), new_registration: T.nilable(String), product: T.nilable(String), qr: T.nilable(String), trusted: T.nilable(T::Boolean)).void }
      def initialize(auth_token: nil, client_identifier: nil, code: nil, created_at: nil, expires_at: nil, expires_in: nil, id: nil, location: nil, new_registration: nil, product: nil, qr: nil, trusted: nil)
        @auth_token = auth_token
        @client_identifier = client_identifier
        @code = code
        @created_at = created_at
        @expires_at = expires_at
        @expires_in = expires_in
        @id = id
        @location = location
        @new_registration = new_registration
        @product = product
        @qr = qr
        @trusted = trusted
      end
    end


    class GetPinResponse < ::OpenApiSDK::Utils::FieldAugmented
      extend T::Sig

      # HTTP response content type for this operation
      field :content_type, String
      # Raw HTTP response; suitable for custom response parsing
      field :raw_response, Faraday::Response
      # HTTP response status code for this operation
      field :status_code, Integer
      # The Pin
      field :two_hundred_application_json_object, T.nilable(Operations::GetPinResponseBody)
      # X-Plex-Client-Identifier is missing
      field :four_hundred_application_json_object, T.nilable(Operations::GetPinPlexTvResponseBody)


      sig { params(content_type: String, raw_response: Faraday::Response, status_code: Integer, two_hundred_application_json_object: T.nilable(Operations::GetPinResponseBody), four_hundred_application_json_object: T.nilable(Operations::GetPinPlexTvResponseBody)).void }
      def initialize(content_type: nil, raw_response: nil, status_code: nil, two_hundred_application_json_object: nil, four_hundred_application_json_object: nil)
        @content_type = content_type
        @raw_response = raw_response
        @status_code = status_code
        @two_hundred_application_json_object = two_hundred_application_json_object
        @four_hundred_application_json_object = four_hundred_application_json_object
      end
    end
  end
end
