/* tslint:disable */
/* eslint-disable */
/**
 * RMI Backend
 * Rug Munch Intelligence — institutional-grade crypto intelligence API. 13+ chains, 96 data providers, 8 MCP tools, x402 paid tier, sovereign-first FOSS.
 *
 * The version of the OpenAPI document: 2026.06.21
 * 
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

import * as runtime from '../runtime';
import {
    type BulkIngestRequest,
    BulkIngestRequestFromJSON,
    BulkIngestRequestToJSON,
} from '../models/BulkIngestRequest';
import {
    type FeedbackRecord,
    FeedbackRecordFromJSON,
    FeedbackRecordToJSON,
} from '../models/FeedbackRecord';
import {
    type HTTPValidationError,
    HTTPValidationErrorFromJSON,
    HTTPValidationErrorToJSON,
} from '../models/HTTPValidationError';
import {
    type IngestRequest,
    IngestRequestFromJSON,
    IngestRequestToJSON,
} from '../models/IngestRequest';
import {
    type IngestResult,
    IngestResultFromJSON,
    IngestResultToJSON,
} from '../models/IngestResult';
import {
    type SearchRequest,
    SearchRequestFromJSON,
    SearchRequestToJSON,
} from '../models/SearchRequest';
import {
    type SearchResponse,
    SearchResponseFromJSON,
    SearchResponseToJSON,
} from '../models/SearchResponse';

export interface BulkApiV1RagV2BulkIngestPostRequest {
    bulkIngestRequest: BulkIngestRequest;
}

export interface FeedbackApiV1RagV2FeedbackPostRequest {
    feedbackRecord: FeedbackRecord;
}

export interface IngestApiV1RagV2IngestPostRequest {
    ingestRequest: IngestRequest;
}

export interface SearchApiV1RagV2SearchPostRequest {
    searchRequest: SearchRequest;
}

/**
 * 
 */
export class RagApi extends runtime.BaseAPI {

    /**
     * Creates request options for bulkApiV1RagV2BulkIngestPost without sending the request
     */
    async bulkApiV1RagV2BulkIngestPostRequestOpts(requestParameters: BulkApiV1RagV2BulkIngestPostRequest): Promise<runtime.RequestOpts> {
        if (requestParameters['bulkIngestRequest'] == null) {
            throw new runtime.RequiredError(
                'bulkIngestRequest',
                'Required parameter "bulkIngestRequest" was null or undefined when calling bulkApiV1RagV2BulkIngestPost().'
            );
        }

        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        headerParameters['Content-Type'] = 'application/json';


        let urlPath = `/api/v1/rag/v2/bulk-ingest`;

        return {
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: BulkIngestRequestToJSON(requestParameters['bulkIngestRequest']),
        };
    }

    /**
     * Ingest many items into a collection sequentially (max 500 per call).
     * Bulk
     */
    async bulkApiV1RagV2BulkIngestPostRaw(requestParameters: BulkApiV1RagV2BulkIngestPostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<{ [key: string]: any; }>> {
        const requestOptions = await this.bulkApiV1RagV2BulkIngestPostRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);

        return new runtime.JSONApiResponse<any>(response);
    }

    /**
     * Ingest many items into a collection sequentially (max 500 per call).
     * Bulk
     */
    async bulkApiV1RagV2BulkIngestPost(requestParameters: BulkApiV1RagV2BulkIngestPostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<{ [key: string]: any; }> {
        const response = await this.bulkApiV1RagV2BulkIngestPostRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Creates request options for feedbackApiV1RagV2FeedbackPost without sending the request
     */
    async feedbackApiV1RagV2FeedbackPostRequestOpts(requestParameters: FeedbackApiV1RagV2FeedbackPostRequest): Promise<runtime.RequestOpts> {
        if (requestParameters['feedbackRecord'] == null) {
            throw new runtime.RequiredError(
                'feedbackRecord',
                'Required parameter "feedbackRecord" was null or undefined when calling feedbackApiV1RagV2FeedbackPost().'
            );
        }

        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        headerParameters['Content-Type'] = 'application/json';


        let urlPath = `/api/v1/rag/v2/feedback`;

        return {
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: FeedbackRecordToJSON(requestParameters['feedbackRecord']),
        };
    }

    /**
     * Record scanner → RAG feedback. Ingests known scam into known_scams collection.
     * Feedback
     */
    async feedbackApiV1RagV2FeedbackPostRaw(requestParameters: FeedbackApiV1RagV2FeedbackPostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<IngestResult>> {
        const requestOptions = await this.feedbackApiV1RagV2FeedbackPostRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);

        return new runtime.JSONApiResponse(response, (jsonValue) => IngestResultFromJSON(jsonValue));
    }

    /**
     * Record scanner → RAG feedback. Ingests known scam into known_scams collection.
     * Feedback
     */
    async feedbackApiV1RagV2FeedbackPost(requestParameters: FeedbackApiV1RagV2FeedbackPostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<IngestResult> {
        const response = await this.feedbackApiV1RagV2FeedbackPostRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Creates request options for ingestApiV1RagV2IngestPost without sending the request
     */
    async ingestApiV1RagV2IngestPostRequestOpts(requestParameters: IngestApiV1RagV2IngestPostRequest): Promise<runtime.RequestOpts> {
        if (requestParameters['ingestRequest'] == null) {
            throw new runtime.RequiredError(
                'ingestRequest',
                'Required parameter "ingestRequest" was null or undefined when calling ingestApiV1RagV2IngestPost().'
            );
        }

        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        headerParameters['Content-Type'] = 'application/json';


        let urlPath = `/api/v1/rag/v2/ingest`;

        return {
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: IngestRequestToJSON(requestParameters['ingestRequest']),
        };
    }

    /**
     * Ingest a document into the RAG system.
     * Ingest
     */
    async ingestApiV1RagV2IngestPostRaw(requestParameters: IngestApiV1RagV2IngestPostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<IngestResult>> {
        const requestOptions = await this.ingestApiV1RagV2IngestPostRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);

        return new runtime.JSONApiResponse(response, (jsonValue) => IngestResultFromJSON(jsonValue));
    }

    /**
     * Ingest a document into the RAG system.
     * Ingest
     */
    async ingestApiV1RagV2IngestPost(requestParameters: IngestApiV1RagV2IngestPostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<IngestResult> {
        const response = await this.ingestApiV1RagV2IngestPostRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Creates request options for searchApiV1RagV2SearchPost without sending the request
     */
    async searchApiV1RagV2SearchPostRequestOpts(requestParameters: SearchApiV1RagV2SearchPostRequest): Promise<runtime.RequestOpts> {
        if (requestParameters['searchRequest'] == null) {
            throw new runtime.RequiredError(
                'searchRequest',
                'Required parameter "searchRequest" was null or undefined when calling searchApiV1RagV2SearchPost().'
            );
        }

        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        headerParameters['Content-Type'] = 'application/json';


        let urlPath = `/api/v1/rag/v2/search`;

        return {
            path: urlPath,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: SearchRequestToJSON(requestParameters['searchRequest']),
        };
    }

    /**
     * RAG search. Returns Pydantic response with hits + scores.
     * Search
     */
    async searchApiV1RagV2SearchPostRaw(requestParameters: SearchApiV1RagV2SearchPostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SearchResponse>> {
        const requestOptions = await this.searchApiV1RagV2SearchPostRequestOpts(requestParameters);
        const response = await this.request(requestOptions, initOverrides);

        return new runtime.JSONApiResponse(response, (jsonValue) => SearchResponseFromJSON(jsonValue));
    }

    /**
     * RAG search. Returns Pydantic response with hits + scores.
     * Search
     */
    async searchApiV1RagV2SearchPost(requestParameters: SearchApiV1RagV2SearchPostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SearchResponse> {
        const response = await this.searchApiV1RagV2SearchPostRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     * Creates request options for statsApiV1RagV2StatsGet without sending the request
     */
    async statsApiV1RagV2StatsGetRequestOpts(): Promise<runtime.RequestOpts> {
        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};


        let urlPath = `/api/v1/rag/v2/stats`;

        return {
            path: urlPath,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        };
    }

    /**
     * Per-collection vector counts + active embedder backend.
     * Stats
     */
    async statsApiV1RagV2StatsGetRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<{ [key: string]: any; }>> {
        const requestOptions = await this.statsApiV1RagV2StatsGetRequestOpts();
        const response = await this.request(requestOptions, initOverrides);

        return new runtime.JSONApiResponse<any>(response);
    }

    /**
     * Per-collection vector counts + active embedder backend.
     * Stats
     */
    async statsApiV1RagV2StatsGet(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<{ [key: string]: any; }> {
        const response = await this.statsApiV1RagV2StatsGetRaw(initOverrides);
        return await response.value();
    }

}
