// @generated by protoc-gen-es v2.13.0 with parameter "target=ts,import_extension=js"
// @generated from file soulfire/download.proto (package soulfire.v1, syntax proto3)
/* eslint-disable */

import type { GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2";
import { fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv2";
import type { ProxyProto } from "./common_pb.js";
import { file_soulfire_common } from "./common_pb.js";
import { file_soulfire_api_docs } from "./api_docs_pb.js";
import { file_google_api_annotations } from "../google/api/annotations_pb.js";
import { file_google_api_field_behavior } from "../google/api/field_behavior_pb.js";
import type { Message } from "@bufbuild/protobuf";

/**
 * Describes the file soulfire/download.proto.
 */
export const file_soulfire_download: GenFile = /*@__PURE__*/
  fileDesc("Chdzb3VsZmlyZS9kb3dubG9hZC5wcm90bxILc291bGZpcmUudjEiMgoKSGVhZGVyUGFpchIQCgNrZXkYASABKAlCA+BBAhISCgV2YWx1ZRgCIAEoCUID4EECIrEBCg9Eb3dubG9hZFJlcXVlc3QSIgoLaW5zdGFuY2VfaWQYASABKAlCDeBBAtLzGAYKBHV1aWQSGQoDdXJpGAIgASgJQgzgQQLS8xgFCgN1cmkSKAoHaGVhZGVycxgDIAMoCzIXLnNvdWxmaXJlLnYxLkhlYWRlclBhaXISKwoFcHJveHkYBCABKAsyFy5zb3VsZmlyZS52MS5Qcm94eVByb3RvSACIAQFCCAoGX3Byb3h5Im4KEERvd25sb2FkUmVzcG9uc2USEQoEZGF0YRgBIAEoDEID4EECEi0KB2hlYWRlcnMYAiADKAsyFy5zb3VsZmlyZS52MS5IZWFkZXJQYWlyQgPgQQISGAoLc3RhdHVzX2NvZGUYAyABKAVCA+BBAjL6AQoPRG93bmxvYWRTZXJ2aWNlEuYBCghEb3dubG9hZBIcLnNvdWxmaXJlLnYxLkRvd25sb2FkUmVxdWVzdBodLnNvdWxmaXJlLnYxLkRvd25sb2FkUmVzcG9uc2UinAHK8xhiCgxEb3dubG9hZCBVUkwaDERPV05MT0FEX1VSTCIIaW5zdGFuY2U6OkZldGNoZXMgcmVtb3RlIGNvbnRlbnQgdGhyb3VnaCB0aGUgc2VydmVyJ3MgbmV0d29yayBzdGFjay6C0+STAjA6ASoiKy92MS9pbnN0YW5jZXMve2luc3RhbmNlX2lkfS9kb3dubG9hZHM6ZmV0Y2hCIQodY29tLnNvdWxmaXJlbWMuZ3JwYy5nZW5lcmF0ZWRQAWIGcHJvdG8z", [file_soulfire_common, file_soulfire_api_docs, file_google_api_annotations, file_google_api_field_behavior]);

/**
 * Represents a single HTTP header as a key-value pair.
 * Used for both request headers (sent to the target server) and
 * response headers (received from the target server).
 *
 * @generated from message soulfire.v1.HeaderPair
 */
export type HeaderPair = Message<"soulfire.v1.HeaderPair"> & {
  /**
   * The header name (e.g., "Content-Type", "Authorization", "Accept").
   * Header names are case-insensitive per HTTP specification.
   *
   * @generated from field: string key = 1;
   */
  key: string;

  /**
   * The header value (e.g., "application/json", "Bearer token123").
   *
   * @generated from field: string value = 2;
   */
  value: string;
};

/**
 * Describes the message soulfire.v1.HeaderPair.
 * Use `create(HeaderPairSchema)` to create a new message.
 */
export const HeaderPairSchema: GenMessage<HeaderPair> = /*@__PURE__*/
  messageDesc(file_soulfire_download, 0);

/**
 * Request message for downloading content from a URL through the SoulFire server.
 * This allows clients to fetch remote resources using the server's network connection,
 * optionally through a proxy, which is useful for accessing resources that may be
 * blocked or rate-limited from the client's network.
 *
 * @generated from message soulfire.v1.DownloadRequest
 */
export type DownloadRequest = Message<"soulfire.v1.DownloadRequest"> & {
  /**
   * The UUID of the SoulFire instance to associate this download with.
   * Used for permission checking - the caller must have DOWNLOAD_URL permission
   * for this instance. Must be a valid UUID string (e.g., "550e8400-e29b-41d4-a716-446655440000").
   *
   * @generated from field: string instance_id = 1;
   */
  instanceId: string;

  /**
   * The URI to download content from. Must be a valid, fully-formed URI
   * (e.g., "https://example.com/resource.json"). The server will make an HTTP GET
   * request to this URI.
   *
   * @generated from field: string uri = 2;
   */
  uri: string;

  /**
   * Optional HTTP headers to include in the request to the target server.
   * These headers are added on top of the default headers set by the server
   * (Accept, Accept-Language, User-Agent). Custom headers can override defaults.
   *
   * @generated from field: repeated soulfire.v1.HeaderPair headers = 3;
   */
  headers: HeaderPair[];

  /**
   * Optional proxy configuration for the download request.
   * If not provided, the request will be made directly from the server.
   * Supports HTTP, SOCKS4, and SOCKS5 proxies with optional authentication.
   *
   * @generated from field: optional soulfire.v1.ProxyProto proxy = 4;
   */
  proxy?: ProxyProto | undefined;
};

/**
 * Describes the message soulfire.v1.DownloadRequest.
 * Use `create(DownloadRequestSchema)` to create a new message.
 */
export const DownloadRequestSchema: GenMessage<DownloadRequest> = /*@__PURE__*/
  messageDesc(file_soulfire_download, 1);

/**
 * Response message containing the downloaded content and metadata.
 * Returned after successfully fetching content from the requested URI.
 *
 * @generated from message soulfire.v1.DownloadResponse
 */
export type DownloadResponse = Message<"soulfire.v1.DownloadResponse"> & {
  /**
   * The raw bytes of the downloaded content.
   * This contains the complete response body from the target server.
   * May be empty if the server returned no content (e.g., 204 No Content).
   *
   * @generated from field: bytes data = 1;
   */
  data: Uint8Array;

  /**
   * All HTTP headers returned by the target server in its response.
   * Includes standard headers like Content-Type, Content-Length, Cache-Control,
   * as well as any custom headers set by the server.
   *
   * @generated from field: repeated soulfire.v1.HeaderPair headers = 2;
   */
  headers: HeaderPair[];

  /**
   * The HTTP status code returned by the target server (e.g., 200, 404, 500).
   * Common values:
   * - 200: OK - Request succeeded
   * - 301/302: Redirect (note: redirects may be followed automatically)
   * - 400: Bad Request
   * - 401: Unauthorized
   * - 403: Forbidden
   * - 404: Not Found
   * - 500: Internal Server Error
   *
   * @generated from field: int32 status_code = 3;
   */
  statusCode: number;
};

/**
 * Describes the message soulfire.v1.DownloadResponse.
 * Use `create(DownloadResponseSchema)` to create a new message.
 */
export const DownloadResponseSchema: GenMessage<DownloadResponse> = /*@__PURE__*/
  messageDesc(file_soulfire_download, 2);

/**
 * Service for downloading content from remote URLs through the SoulFire server.
 * This service acts as a proxy, allowing clients to fetch remote resources using
 * the server's network connection and optionally through a configured proxy.
 *
 * Use cases include:
 * - Downloading resources that may be blocked from the client's network
 * - Fetching content through a specific proxy for anonymity or geo-unlocking
 * - Centralizing external API calls through the server
 *
 * The service uses a Reactor Netty HTTP client with:
 * - 5-second response timeout
 * - Automatic compression support
 * - Default Accept, Accept-Language, and User-Agent headers
 *
 * Authorization:
 * - Requires a valid JWT token
 * - Caller must have DOWNLOAD_URL permission for the specified instance
 *
 * Error handling:
 * - Returns gRPC INTERNAL status on network errors, timeouts, or server failures
 * - The error description contains details about the failure
 *
 * @generated from service soulfire.v1.DownloadService
 */
export const DownloadService: GenService<{
  /**
   * Downloads content from the specified URI and returns the response.
   *
   * Makes an HTTP GET request to the URI specified in the request, optionally
   * routing through a proxy. Custom headers can be provided to customize the request.
   *
   * Parameters:
   *   request - Contains the target URI, instance ID for permissions, optional headers,
   *             and optional proxy configuration
   *
   * Returns:
   *   The downloaded content as bytes, along with response headers and HTTP status code
   *
   * Errors:
   *   PERMISSION_DENIED - Caller lacks DOWNLOAD_URL permission for the instance
   *   INTERNAL - Network error, connection timeout, invalid URI, or other server error
   *
   * @generated from rpc soulfire.v1.DownloadService.Download
   */
  download: {
    methodKind: "unary";
    input: typeof DownloadRequestSchema;
    output: typeof DownloadResponseSchema;
  },
}> = /*@__PURE__*/
  serviceDesc(file_soulfire_download, 0);
